<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/24524/strange-error-suspect-comiler-or-linker-fault</link><description> 
This one is driving me crazy, so I just wanted to know if anyone
has any hints as to how I might fix this. 

 
I have compiled zlib as a library, and I have included the
lib-file in my project along with the header files for the exported
functions.</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/124991?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 16:53:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a9889769-1575-451b-a217-d73bfb86a739</guid><dc:creator>Oyvind Kaurstad</dc:creator><description>&lt;p&gt;&lt;p&gt;
I tried compiling the library in ARM mode (no Thumb) and I turned
off interworking. This unfortunately makes the library a lot bigger,
but it seems (only time will tell) to solve the problem.&lt;/p&gt;

&lt;p&gt;
My guess is that this forces a certain alignment, but I can&amp;#39;t be
sure.&lt;/p&gt;

&lt;p&gt;
In any case, I find this solution to be borderline bearable, but I
am not satisfied that I still don&amp;#39;t know exactly why it fails. And I
would certainly have preferred being able to compile the library in
thumb mode to save some (a few kBs, actually) of space.&lt;/p&gt;

&lt;p&gt;
So, if anyone has any more feedback on this, please chime in!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/114335?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 14:55:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ffb12bfd-703e-46d0-87d1-0239c3433d40</guid><dc:creator>Oyvind Kaurstad</dc:creator><description>&lt;p&gt;&lt;p&gt;
I actually have been looking at it with the debugger, and all the
actual data that is used by the inflate()-function is the same in
both cases, but in one case inflate() returns with an error code, in
the other it doesn&amp;#39;t. The code doesn&amp;#39;t crash in any way, it&amp;#39;s just
that inflate() is unable to do the job.&lt;/p&gt;

&lt;p&gt;
I am now guessing that the error is within the zlib-code itself.
Not a bug, but perhaps some assumption that may cause trouble when
the code alignment changes.&lt;/p&gt;

&lt;p&gt;
I was kinda hoping to avoid problems like this by choosing tried
and proven code...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/114337?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 14:08:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:5b6f0730-ccf9-4f99-9a60-63b818cc73c4</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
Andy,&lt;br /&gt;
I have a certain product at work that runs on a processor that does
not have a built-in debug interface (C167). The software does not
support debugging via a serial port, and guess what - it has the
EXACT same problem as the OP...Even if absolutely dead code is
removed, the program will crash at arbitrary moments. I guess it that
damn legacy code again, but I cannot find it! It work as it is (as
long as you add code at the end of modules...), which is,
unfortunately, good enough until we flush it down the nearest
toilet...!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/101204?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 13:43:25 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1b76bde6-1995-4556-9abc-22fc7ebfd3a3</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;What I don&amp;#39;t understand is that I am letting the compiler and
linker take care of the alignment, I am not forcing code to
particular addresses.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
You may not be forcing it, but you might be &lt;i&gt;assuming&lt;/i&gt; it
somewhere; eg, in a reference via a pointer...&lt;/p&gt;

&lt;p&gt;
The only way to track down this sort of problem is to get in there
with the debugger; it can be hard enough with the source and target
in front of you - it&amp;#39;s impossible to do from afar without the source
or the target or even a clear idea of what the thing is actually
doing!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/76789?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 13:31:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:aaa9cea0-2f5b-4a1b-9f13-75d4951cb2b2</guid><dc:creator>Oyvind Kaurstad</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks for your tips. Declaring one or more of the local variables
in the function that uses zlib also &amp;quot;fixes&amp;quot; the problem, but it is
still coincidental. I can declare a local variable in a completely
different function as volatile and also &amp;quot;fix&amp;quot; the problem.&lt;/p&gt;

&lt;p&gt;
The point is, none of the local variables (in this case) needs to
be volatile, so declaring one or more of them as volatile does just
the same as adding the space to the string: It alters code size so
that something changes alignment.&lt;/p&gt;

&lt;p&gt;
What I don&amp;#39;t understand is that I am letting the compiler and
linker take care of the alignment, I am not forcing code to
particular addresses.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/101203?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 12:45:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b05f6cf8-bb5a-41e4-99f5-9f50f5a45480</guid><dc:creator>Catcus Blip</dc:creator><description>&lt;p&gt;&lt;p&gt;
a small tip: if you happen to use inline assembly in your code -
replace it with embedded assembly. that way you know for sure that
your assembly remains untouched by the compiler!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/52665?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 12:33:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:dfa51ffa-7f4b-46db-82c8-e347737d0df4</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&amp;quot;If I change the optimization level I can &amp;quot;fix&amp;quot; the error, but
that is of course just conicidence.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
No, it is probably not just coincidence.&lt;/p&gt;

&lt;p&gt;
it probably goes to show that there is a fault in your code, but
you just happen to get away with it at the other optimisation
level.&lt;/p&gt;

&lt;p&gt;
eg, have you checked that everything that ought to be volatile is
volatile...?&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;&amp;quot;I added a missing space to a literal string somewhere in my
code.&amp;quot;&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
That could mean that everything after that location in your code
space is moved up by 1 byte - so, for instance, something that was
correctly aligned before is now mis-aligned...&lt;br /&gt;
Or something got pushed into a faulty address range on your
target...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/76790?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 11:58:56 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:157ee039-20ef-4926-8907-96ff8c2d9cb8</guid><dc:creator>Oyvind Kaurstad</dc:creator><description>&lt;p&gt;&lt;p&gt;
Thanks, but I have already done that, didn&amp;#39;t help.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Strange error (suspect comiler or linker fault)</title><link>https://community.arm.com/thread/52667?ContentTypeID=1</link><pubDate>Sat, 18 Oct 2008 09:51:51 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ceaa9d33-f75d-4f16-ae7a-4d4754bcdd71</guid><dc:creator>doubt that my ISP Al Bradford</dc:creator><description>&lt;p&gt;&lt;p&gt;
When I get a strange action as you described, I first check that I
have plenty of stack space set up in my start file. I suggest that
you look in the stack configuration first.&lt;br /&gt;
Bradford&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>