This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64185] Optimized code gives unexpected results
- From: "zaz at ua7 dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 09 Dec 2014 00:23:49 +0000
- Subject: [Bug c/64185] Optimized code gives unexpected results
- Auto-submitted: auto-generated
- References: <bug-64185-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64185
--- Comment #2 from zaz at ua7 dot net ---
But this is deliberate out-of-bands. IE in this test application searchDict2
lookup all KV fields in dict structure in loop based on kv1 offset:
kv1 + 0 - this is pointer to kv1
kv1 + 1 - this is pointer to kv2
kv1 + 2 - this is pointer to kv3
etc
All other C compilers (tested on CLANG and Microsoft C compiller) and early
version of GCC (for example 4.3 in CentOS 6) work with this test as expected.
And as I know many C projects (for example asterisk) use similar code for
manage complex structures. For example asterisk have a lot structures like
this:
struct PascalString
{
int length;
char data[0];
};
And then just allocate necessary memory block and able access to something
like:
ps.data[100] - if allocated block have enough size.
As I told before original problem was found in opensource library sofia-sip-ua
in code which not changed many years.
In any case you able leave this issue without without any attention - but I
recommend you take a look on this problem a bit closer.