This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
On Mon, Oct 29, 2007 at 08:37:52PM +0100, Duncan Sands wrote:
> Hi Tomash,
>
> > moonlight:/tmp$ /usr/local/gcc-4.3-trunk/bin/gcc -O0 mmap.c -o mmap
> > moonlight:/tmp$ ./mmap
> > GCC is the best compiler ever!
> > moonlight:/tmp$ /usr/local/gcc-4.3-trunk/bin/gcc -O1 mmap.c -o mmap
> > moonlight:/tmp$ ./mmap
> > Segmentation fault
>
> I don't see this with gcc 4.1 or 4.2. Just a data point.
I tried this and didn't see any problems with 4.1.1 20070105 and 4.3.0
20070907 (Linux/amd64) with or without optimization (-O0, -O2, -O2
-ftree-vectorize). I thought the relevant optimization pass went in to
gcc 3.4?
-Jack