This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Possible Bug
Nathan Boley <npboley@gmail.com> writes:
> In a much larger application, I was getting a weird segfault that an
> assignment to a temporary variable fixed. I distilled the example into
> the attached "test_case.c". When I run test_case.c under valgrind I
> get a memory read error, and it segfaults with electric fence, but I'm
> not actually able to get a true segfault. However, I am pretty sure
> that the same issue was causing the segfault in my application.
There is nothing wrong if gcc is reading an 8-byte value at an 8-byte
aligned address. That can not cause a memory read error. To a program
like valgrind it may look like a read of an uninitialized memory
location, but because the location is aligned and the values loaded from
the uninitialized memory is ignored, everything will work fine.
That said, I could not recreate the problem with your test case. I only
see 4-byte loads.
Ian