gcc-3.4.2 or libpthread bug?
Peter Seiderer
ps.report@gmx.net
Wed Sep 15 09:53:00 GMT 2004
> Peter Seiderer wrote:
> > the following attached testprogramm gives a SIGSEGV when compiled
> > with gcc-3.4.2 and '-march=pentium4 -O2' on my Linux box (Suse-8.2),
> > I think because of a misaligned movapd.
> > Is it a gcc or a libpthread bug?
>
> I think it could be argued that both are broken.
>
> Gcc is broken because it is emitting SSE vector instructions even though
> you didn't ask for them and the ABI doesn't support them. The problem
> is in the i386.md negdf2 pattern which emits a movapd if TARGET_SSE2 is
> true, and -march=pentium4 turns on TARGET_SSE2. The 32-bit x86 ABI says
> that the stack has only 32-bit alignment, so it is not safe to use these
> instructions behind the user's back.
>
> I see two possible ways to fix this. One is to change the code so that
> TARGET_SSE2 is only enabled for 32-bit code if the user specifies
> -msse2. This would then be double checked against the CPU target to
> make sure the CPU supports it. There needs to be a distinction here
> between whether the processor supports the feature, and whether the user
> asked for it to be used.
>
> The other possible solution is to modify the negdf2 pattern to check
> TARGET_64BIT (or something equivalent), so that we only emit movapd when
> we know that it is safe. This is simpler, and probably better.
>
> It can also be argued that libpthread is broken. Although the ABI only
> requires 32-bit alignment, new processor features such as SSE require
> 64-bit alignment for some instructions, and hence if you want to be able
> to use all processor features, you must align stacks to 64-bits even
> though the ABI only requires 32-bits.
>
> I'd suggest filing a bug report into bugzilla if you haven't already
> done so, so we can track the problem.
> --
> Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
>
Thanks for your answer and the suggested fix.
There is already a bug report #14776
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14776
reported first againts 3.4.0, but no action taken since march 2004,
mayby because the bugreport is targeted for i686-pc-cygwin....
--
NEU: GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++
More information about the Gcc
mailing list