[Bug 1474304] [NEW] miscompilation with conditional operator side effects (ARM64)

Роман Донченко dpb at corrigendum.ru
Tue Jul 14 10:18:27 UTC 2015


Public bug reported:

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 15.04
Release:	15.04
Codename:	vivid

$ gcc --version
gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -dumpmachine
aarch64-linux-gnu

$ gcc -O0 -std=c11 repro.c ; ./a.out ; echo $? # repro.c attached
0

$ gcc -O2 -std=c11 repro.c ; ./a.out ; echo $?
1

I don't think this program triggers any undefined behavior, so the
optimized version is miscompiled.

I wasn't able to reproduce this with with vanilla 4.9.2.

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

** Attachment added: "program exhibiting the bug"
   https://bugs.launchpad.net/bugs/1474304/+attachment/4428649/+files/repro.c

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

Title:
  miscompilation with conditional operator side effects (ARM64)

Status in gcc-4.9 package in Ubuntu:
  New

Bug description:
  $ lsb_release -a
  No LSB modules are available.
  Distributor ID:	Ubuntu
  Description:	Ubuntu 15.04
  Release:	15.04
  Codename:	vivid

  $ gcc --version
  gcc (Ubuntu/Linaro 4.9.2-10ubuntu13) 4.9.2
  Copyright (C) 2014 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

  $ gcc -dumpmachine
  aarch64-linux-gnu

  $ gcc -O0 -std=c11 repro.c ; ./a.out ; echo $? # repro.c attached
  0

  $ gcc -O2 -std=c11 repro.c ; ./a.out ; echo $?
  1

  I don't think this program triggers any undefined behavior, so the
  optimized version is miscompiled.

  I wasn't able to reproduce this with with vanilla 4.9.2.

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



More information about the foundations-bugs mailing list