[Bug 1826820] Re: calling setjmp destruct a variable

Paul White 1826820 at bugs.launchpad.net
Mon Apr 29 04:16:41 UTC 2019


** Package changed: ubuntu => gcc-7 (Ubuntu)

** Tags removed: gcc
** Tags added: bionic

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

Title:
  calling setjmp destruct a variable

Status in gcc-7 package in Ubuntu:
  New

Bug description:
  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.

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



More information about the foundations-bugs mailing list