Public bug reported:

In Ubuntu 18.04 armhf with gcc-7, the following code, which compiles
normally, gives incorrect result (on my machine, -964176505 instead of
correct value 1).
#include <setjmp.h>
#include <stdio.h>

jmp_buf a[10] ;
jmp_buf * volatile sp = a ;

int main()
{
    if (setjmp(*sp++) == 0) {
        printf("diff=%td\n", sp-a) ;
        return 0 ;
    }
    return 1 ;
}

Additional information:
The above code gives correct answer on Ubuntu 16.04 x86_64 gcc 5.4.
If I replace '*sp++' with '*++sp', the program gives correct value 1.

** Affects: ubuntu
     Importance: Undecided
         Status: New


** Tags: armhf gcc setjmp

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

Title:
  calling setjmp destruct a variable

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+bug/1826820/+subscriptions

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

Reply via email to