[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-08-22 Thread Christophe Lyon
** Changed in: gcc-linaro
   Status: New => Fix Released

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-06-27 Thread Michael Collison
** Changed in: gcc-linaro
 Assignee: (unassigned) => Michael Collison (michael-collison)

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-02-12 Thread Launchpad Bug Tracker
** Branch linked: lp:debian/gnat-4.8

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-01-12 Thread Launchpad Bug Tracker
This bug was fixed in the package gcc-4.8 - 4.8.2-13ubuntu1

---
gcc-4.8 (4.8.2-13ubuntu1) trusty; urgency=medium

  * Merge with Debian; remaining changes:
- Build from the upstream source.

gcc-4.8 (4.8.2-13) unstable; urgency=medium

  * Update to SVN 20140112 (r206564) from the gcc-4_8-branch.
- Fix miscompilation due to wrong RTL-optimization (see
  PR rtl-optimization/59137). Closes: #716635.

  [ Aurelien Jarno ]
  * Reenable the testsuite on mips.

  [ Matthias Klose ]
  * Add libgcc, libstdc++, libgfortran symbols files for ppc64el.
  * Update libitm symbols for non-default multilibs.
  * Add libgcc, libstdc++, libgfortran symbols files for arm64.
  * Fix PR target/59588 (AArch64), backport proposed patch. LP: #1263576.
  * Fix PR target/59744 (AArch64), taken from the trunk. LP: #1267761.
 -- Matthias KloseSun, 12 Jan 2014 14:16:19 +0100

** Changed in: gcc-4.8 (Ubuntu Trusty)
   Status: Confirmed => Fix Released

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-01-12 Thread Launchpad Bug Tracker
** Branch linked: lp:debian/gcc-4.8

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-01-12 Thread Bug Watch Updater
** Changed in: gcc
   Status: Confirmed => Fix Released

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-01-10 Thread Bug Watch Updater
Launchpad has imported 2 comments from the remote bug at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59744.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.


On 2014-01-10T00:30:27+00:00 Michael Hudson-Doyle wrote:

Hi,

This slightly strangely written program (it's distilled down from
frame_offset_overflow in the gcc source itself) should print "bigger" if
the first argument is bigger than 10 (or negative, but let's ignore that
please):

#include 
#include 

int a[2] = { 10, 20 };

int
is_bigger (long offset, int index)
{
  unsigned long size = -offset;

  if (size > a[index])
{
  printf("bigger\n");
  return 1;
}

  return 0;
}


int
main (int argc, char** argv)
{
  long v;
  v = atol(argv[1]);
  is_bigger(-v, 0);
  return 0;
}

When compiled at -O1 or above (and with inlining disabled at -O2 and
above), though, it bungles the 0 case:

(t-doko)mwhudson@arm64:~$ gcc-4.9 -O3 test.c -o test -fno-inline -Wall
(t-doko)mwhudson@arm64:~$ ./test 1
(t-doko)mwhudson@arm64:~$ ./test 11
bigger
(t-doko)mwhudson@arm64:~$ ./test 0 
bigger
(t-doko)mwhudson@arm64:~$ gcc-4.9 -O0 test.c -o test -Wall
(t-doko)mwhudson@arm64:~$ ./test 1
(t-doko)mwhudson@arm64:~$ ./test 11
bigger
(t-doko)mwhudson@arm64:~$ ./test 0
(t-doko)mwhudson@arm64:~$ 

What's going on?  Here's the disassembly of is_bigger (at O3):

00400608 :
  400608:   b082adrpx2, 411000 <_GLOBAL_OFFSET_TABLE_+0x28>
  40060c:   91010042add x2, x2, #0x40
  400610:   a9bf7bfdstp x29, x30, [sp,#-16]!
  400614:   5283mov w3, #0x0// #0
  400618:   910003fdmov x29, sp
  40061c:   b8a1d841ldrsw   x1, [x2,w1,sxtw #2]
  400620:   ab3fcmn x1, x0
  400624:   54a2b.cs400638 
  400628:   9000adrpx0, 40 <_init-0x3f8>
  40062c:   911b6000add x0, x0, #0x6d8
  400630:   9790bl  400470 
  400634:   52800023mov w3, #0x1// #1
  400638:   2a0303e0mov w0, w3
  40063c:   a8c17bfdldp x29, x30, [sp],#16
  400640:   d65f03c0ret

Basically it seems that the condition "-offset > val" is being compiled
as "val + offset does not overflow", which is not valid for offset == 0.

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1267761/comments/0


On 2014-01-10T01:00:19+00:00 Pinskia wrote:

(insn 14 13 15 2 (set (reg:CC_SWP 66 cc)
(compare:CC_SWP (neg:DI (reg:DI 0 x0 [ offset ]))
(reg:DI 1 x1 [orig:85 D.3895 ] [85]))) t7.c:11 114 {*compare_negdi}
 (expr_list:REG_DEAD (reg:DI 1 x1 [orig:85 D.3895 ] [85])
(expr_list:REG_DEAD (reg:DI 0 x0 [ offset ])
(nil

--- CUT ---
Here is a testcase that fails at -O1 and above without any arguments.

int a[2] = { 10, 20 };

int
is_bigger (long, int) __attribute__((noinline,noclone));

int
is_bigger (long offset, int index)
{
  unsigned long size = -offset;

  if (size > a[index])
   return 1;

  return 0;
}


int
main (int argc, char** argv)
{
  long v;
  if (is_bigger(0, 0))
__builtin_abort ();
  if (!is_bigger(1, 0))
__builtin_abort ();
  if (is_bigger(-10, 0))
__builtin_abort ();
  if (!is_bigger(10, 0))
__builtin_abort ();
  return 0;
}

Reply at: https://bugs.launchpad.net/gcc-linaro/+bug/1267761/comments/1


** Changed in: gcc
   Status: Unknown => Confirmed

** Changed in: gcc
   Importance: Unknown => Medium

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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


[Bug 1267761] Re: miscompilation of unsigned comparison on aarch64

2014-01-10 Thread Matthias Klose
** Also affects: gcc-4.8 (Ubuntu)
   Importance: Undecided
   Status: New

** Also affects: gcc-4.8 (Ubuntu Trusty)
   Importance: Undecided
   Status: New

** Changed in: gcc-4.8 (Ubuntu Trusty)
   Importance: Undecided => High

** Changed in: gcc-4.8 (Ubuntu Trusty)
   Status: New => Confirmed

** Changed in: gcc-4.8 (Ubuntu Trusty)
Milestone: None => ubuntu-14.01

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

Title:
  miscompilation of unsigned comparison on aarch64

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

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