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 middle-end/48377] [4.6 regression] miscompilation at -O3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48377

--- Comment #10 from Matt Hargett <matt at use dot net> 2011-04-06 22:22:41 UTC ---
I do see the alignment problem you point out (though I'm disappointed that
neither PC-Lint nor GCC's warnings alerted me). I made the changes you
proposed, but still get the same crash:

typedef uint32_t unaligned_uint32_t __attribute__((__aligned__
(1),__may_alias__));

// ...

static inline uint32_t
Hashcode( const char* s, uint32_t len, bool case_insensitive)
{
        const unaligned_uint32_t* wordp = (const unaligned_uint32_t*)s;
// ...
}


==30742== Process terminating with default action of signal 11 (SIGSEGV)
==30742==  General Protection Fault
==30742==    at 0x400F38: TE_Field_id::Initialize_token_maps()
(hashmap.hpp:672)
==30742==    by 0x4017A8: main (te_main.cpp:5)

It crashes on the same line (with or without valgrind):
                        hash += *wordp++ & 0xdfdfdfdf;

For grins, I initialized the hash variable and cast the 0xdfdfdfdf constant to
unaligned_uint32_t as well, but the problem persists. I did verify that
removing -ftree-vectorize alone does fix the eliminate the crash;
"-O2 -finline-functions -funswitch-loops -fpredictive-commoning
-fgcse-after-reload -fipa-cp-clone -ftree-loop-distribute-patterns
-ftree-slp-vectorize" does not crash.

So, is there a bug in the annotations you suggested? Is there any other "easy"
workaround besides disabling the optimization on this function?

Very sincerely, thanks for working with me on this issue! :)


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