egcs/Solaris status
Dimitri PAPADOPOULOS-ORFANOS
papadopo@shfj.cea.fr
Fri Aug 27 09:16:00 GMT 1999
I wrote:
>
> Alexandre Oliva wrote:
>
> > On Aug 21, 1999, Dimitri Papadopoulos <dpo@club-internet.fr> wrote:
> >
> > > 3) I get segfault/aritmetic exception in Qt ( http://www.troll.no/ ),even
> > > without -O. The problem is not with Qt:
> > > - The very same source compiled with egcs-1.1.2 or Sun CC does not
> > > crash.
> >
> > Did you try to compile with -fno-strict-aliasing? -fstring-aliasing,
> > now enabled by default, has caused some problems to packages that use
> > certain kinds of casts of pointers with undefined results.
>
> I tried to compile with -fno-strict-aliasing and using GNU as/ld
> this morning. I still get the same segfault [...]
Indeed, after a few more tests:
- This is not an -fstrict-aliasing/-fno-strict-aliasing issue.
These switches make no real difference. In fact, the program
fails less often when using -fstrict-aliasing than when using
-fno-strict-aliasing.
- This is not really a Sun as/ld issue. I have built Qt with Sun
as/ld and then with GNU as/ld. The program fails less often when
using GNU as/ld, but fails nevertheless.
I believe this is a Solaris bug that triggers a crash more or
less often depending on the use of GNU as/ld vs. Sun as/ld or
on the use of -fno-strict-aliasing. These options have a
small impact on the binary files output produced by the GCC.
Depending on which option was chosen, the program crashes more
or less frequently:
- GCC 2.95.1 with GNU as/ld (<binutils>/bin in the PATH +
links in <gcc>/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1 +
/usr/ccs/bin out of the PATH + -fstrict-aliasing):
The program crashes randomly (1 failure out of ~100 runs).
$ ./examples/application/application
$ ./examples/application/application
$ ./examples/application/application
$ ./examples/application/application
*** never allocated!
Floating exception
$ ./examples/application/application
$ ./examples/application/application
$ ./examples/application/application
- GCC 2.95.1 used with Sun as/ld (/usr/ccs/bin in the PATH
+ no links in <gcc>/lib/gcc-lib/sparc-sun-solaris2.7/2.95.1
+ -fstrict-aliasing):
The program crashes every time, except the first time it
is run after a login or after other heavy use of the machine.
The program crashes because in some method 'this' is an invalid,
never allocated pointer (I keep track of allocated pointers),
and because a private variable 'vlen' of this inexistant 'this'
has a value of 0 and is used this way:
... = ... % vlen;
If I build with EGCS 1.1.2, the program never crashes. When I
build with GCC 2.95.1, the program crashes randomly, but never
the first time the shared library is loaded. In addition,
building with GCC 2.95.1 on Linux does never result in a crash.
Any ideas? A problem in the SPARC assembler output by GCC? A
problem in the Solaris runtime linker? How to debug this? Is
this a known problem with Solaris 7?
Thank you in advance,
--
Dimitri Papadopoulos
More information about the Gcc
mailing list