This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/51821] [4.5/4.6/4.7 Regression] 64bit > 32bit conversion produces incorrect results with optimizations


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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-11
      Known to work|                            |4.4.6
   Target Milestone|---                         |4.5.4
            Summary|64bit > 32bit conversion    |[4.5/4.6/4.7 Regression]
                   |produces incorrect results  |64bit > 32bit conversion
                   |with optimizations          |produces incorrect results
                   |                            |with optimizations
     Ever Confirmed|0                           |1
      Known to fail|                            |4.5.3, 4.6.2, 4.7.0

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-01-11 11:21:25 UTC ---
Confirmed.  Reduced testcase:

extern void abort (void);

unsigned int __attribute__((noinline,noclone))
test(unsigned int shift_size)
{
    unsigned long long res = 0;
    res = ~res;
    res = res << shift_size;
    return res;
}

int
main()
{
    unsigned int dst = sizeof (unsigned int) * 8;
    if (test(dst) != 0)
      abort ();
    return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]