Public bug reported:

I'm using Quantal on PowerPC. I'm compiling an open-source application
that uses setjmp/longjmp. The code compiles fine but when executing the
code, the error message "longjmp causes uninitialized stack frame" is
printed and the program crashes.

The code is regularly regression tested on PowerPC (with gcc 4.1.2) and
on x86 and the tests don't show this problem.

On the Quantal PowerPC system, the code works fine without optimizations
(i.e. using -O0). It also works on that system when compiled with clang
(with optimizations). In the case of clang, some minor changes needed to
be made to the source to make it compile.

Therefore, I suspect that this is a bug in gcc. I'm not sure if I can
produce a reduced test case from the open source application. However, a
slightly modified version of a setjmp example from Wikipedia (code
attached) shows similar (albeit not identical) symptoms.

The expected output of the attached code is:
Child loop begin
Parent
Child loop end
Parent

The output of the attached code  when compiled on powerpc with "gcc -O 
filename" is:
Child loop begin
Parent
��]�[<- varies from run to run. I guess the string is being overwritten]
Parent

Interestingly, this problem disappears with -O2 in the attached code
(the problem in the open-source application doesn't disappear at O2,
though).

Output of apt-cache policy gcc-4.7:
  Installed: 4.7.2-2ubuntu1
  Candidate: 4.7.2-2ubuntu1
  Version table:
 *** 4.7.2-2ubuntu1 0
        500 http://ports.ubuntu.com/ubuntu-ports/ quantal/main powerpc Packages
        100 /var/lib/dpkg/status

PS: I can't paste the output of 'lsb_release -rd' because I'm working in
a chroot and lsb_release isn't installed there. If you really need it, I
will ask for installation of the package.

** Affects: gcc-4.7 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Example code that exhibits the bug when compiled with -O"
   
https://bugs.launchpad.net/bugs/1115544/+attachment/3514793/+files/powerPCSetjmpLongjmpCorruption.c

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1115544

Title:
  Memory corruption on PowerPc when using setjmp/longjmp

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.7/+bug/1115544/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to