public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/31363]  New: long long optimization problem
@ 2007-03-26 14:17 gr at collax dot com
  2007-03-26 15:43 ` [Bug other/31363] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: gr at collax dot com @ 2007-03-26 14:17 UTC (permalink / raw)
  To: gcc-bugs

gcc version 4.0.4
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/var/tmp

compiling with "-O" on input:

void
foo(unsigned long long c)
{
        if (c & 0x80000000)
                puts("bug");
}

int
main(void)
{
        foo(0x100000000ULL);
        return 0;
}

produces "bug". Without "-O", it does not.


-- 
           Summary: long long optimization problem
           Product: gcc
           Version: 4.0.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gr at collax dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31363


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug other/31363] long long optimization problem
  2007-03-26 14:17 [Bug other/31363] New: long long optimization problem gr at collax dot com
@ 2007-03-26 15:43 ` rguenth at gcc dot gnu dot org
  2007-03-26 18:03 ` [Bug target/31363] " gr at collax dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-26 15:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-03-26 16:43 -------
Works for me.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31363


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31363] long long optimization problem
  2007-03-26 14:17 [Bug other/31363] New: long long optimization problem gr at collax dot com
  2007-03-26 15:43 ` [Bug other/31363] " rguenth at gcc dot gnu dot org
@ 2007-03-26 18:03 ` gr at collax dot com
  2007-03-26 18:09 ` pinskia at gcc dot gnu dot org
  2009-09-17 10:13 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: gr at collax dot com @ 2007-03-26 18:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from gr at collax dot com  2007-03-26 19:03 -------
(In reply to comment #1)
> Works for me.

Hm. Just to be completely sure, my source archive gcc-4.0.4.tar.bz2 has md5sum
8970debbc55bea85ee80961d733080f0, as two other copies fetched from different
mirrors. I compiled it on two different i386 Linux distributions, getting the
same result in both cases.

The generated assembler code in question is

foo:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        movl    8(%ebp), %eax
        movl    12(%ebp), %edx
        andl    $-2147483648, %eax
        movl    %edx, %ecx
        orl     %eax, %ecx
        je      .L4
        movl    $.LC0, (%esp)
        call    puts
.L4:
        leave
        ret

If I understand this correctly, the upper half of the long long, in %edx,
remains unaltered but is ORed into the value that is finally tested.

What conditions could have lead to different results here?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31363


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31363] long long optimization problem
  2007-03-26 14:17 [Bug other/31363] New: long long optimization problem gr at collax dot com
  2007-03-26 15:43 ` [Bug other/31363] " rguenth at gcc dot gnu dot org
  2007-03-26 18:03 ` [Bug target/31363] " gr at collax dot com
@ 2007-03-26 18:09 ` pinskia at gcc dot gnu dot org
  2009-09-17 10:13 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-03-26 18:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2007-03-26 19:09 -------
I could reproduce this with "4.0.4 20060622" but it works on the trunk.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31363


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/31363] long long optimization problem
  2007-03-26 14:17 [Bug other/31363] New: long long optimization problem gr at collax dot com
                   ` (2 preceding siblings ...)
  2007-03-26 18:09 ` pinskia at gcc dot gnu dot org
@ 2009-09-17 10:13 ` ubizjak at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: ubizjak at gmail dot com @ 2009-09-17 10:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2009-09-17 10:12 -------
(In reply to comment #3)
> I could reproduce this with "4.0.4 20060622" but it works on the trunk.

So, fixed.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31363


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-17 10:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-26 14:17 [Bug other/31363] New: long long optimization problem gr at collax dot com
2007-03-26 15:43 ` [Bug other/31363] " rguenth at gcc dot gnu dot org
2007-03-26 18:03 ` [Bug target/31363] " gr at collax dot com
2007-03-26 18:09 ` pinskia at gcc dot gnu dot org
2009-09-17 10:13 ` ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).