This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/64185] Optimized code gives unexpected results


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]