This is the mail archive of the gcc@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]

Re: mutable members in global const objects


On Tue, Aug 04, 1998 at 10:34:29AM -0400, Tim Hollebeek wrote:
> wagner:~:104> g++ -v
> Reading specs from /usr/local/lib/gcc-lib/mips-sgi-irix5.3/egcs-2.90.27/specs
> gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
> wagner:~:105> g++ -O4 foo.C
> wagner:~:106> ./a.out
> This code is fine.

It varies between targets then.

tantalophile:~/t$ g++ -v -O t.cc
Reading specs from /usr/lib/gcc-lib/i386-linux/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
tantalophile:~/t$ ./a.out 
Segmentation fault (core dumped)

tantalophile:~/t$ perl -pi.bak -e 's/s =/s __attribute__((section(".data"))) =/;' t.cc

tantalophile:~/t$ g++ -v -O t.cc
Reading specs from /usr/lib/gcc-lib/i386-linux/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
tantalophile:~/t$ ./a.out 
This code is wrong.

-- Jamie


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