Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 358177

Summary: app-editors/emacs-23.3 segmentation fault with -fstrict-aliasing
Product: Gentoo Linux Reporter: Ulrich Müller <ulm>
Component: Current packagesAssignee: GNU Emacs project <gnu-emacs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
URL: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8217
See Also: https://bugs.gentoo.org/show_bug.cgi?id=839405
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 915000    
Attachments: build log
emerge --info
gdb backtrace

Description Ulrich Müller gentoo-dev 2011-03-10 07:50:57 UTC
Emacs 23.3 built with USE="X Xaw3d -gtk -motif" fails with a
segmentation fault at runtime. This is with -O2 in CFLAGS, on amd64.

The problem disappears when -fno-strict-aliasing is added to CFLAGS.

I've narrowed it down further:
- compile src/xterm.c with -O1,
  compile the rest of the sources with -O2
  => Success
- compile src/xterm.c with -O2,
  compile the rest of the sources with -O1
  => Failure
- compile src/xterm.c with -O2 -fno-strict-aliasing,
  compile the rest of the sources with -O2
  => Success
- compile src/xterm.c with -O1 -fgcse -fstrict-aliasing,
  compile the rest of the sources with -O1
  => Failure
Comment 1 Ulrich Müller gentoo-dev 2011-03-10 07:52:24 UTC
Created attachment 265413 [details]
build log
Comment 2 Ulrich Müller gentoo-dev 2011-03-10 07:52:51 UTC
Created attachment 265415 [details]
emerge --info
Comment 3 Ulrich Müller gentoo-dev 2011-03-10 07:53:33 UTC
Created attachment 265417 [details]
gdb backtrace
Comment 4 Ulrich Müller gentoo-dev 2011-03-10 08:09:00 UTC
FWIW, this happens with all of GCC 4.3.5, 4.4.5, and 4.5.2.
Comment 5 Ulrich Müller gentoo-dev 2011-03-10 08:42:48 UTC
Reported upstream.

I'll add -fno-strict-aliasing as a workaround in the ebuild.
Comment 6 Ulrich Müller gentoo-dev 2023-10-01 08:48:36 UTC
Quoting from the upstream bug <https://debbugs.gnu.org/8217#32>:

... I find that the workaround of adding -fno-strict-aliasing to CFLAGS wasn't present for version 24.1, and there never were any bugs reported to us. This seems to indicate that the problem had disappeared already in early Emacs 24 versions.

However, I also cannot reproduce this any more with Emacs 23.4 and GCC 5.4.0 (nor with GCC 4.9.3). So it may well be that this issue wasn't with Emacs but with GCC.