[Bug c/54951] New: Incorrect pointer handling on 32K boundary

m.galante at centrosistemi dot it gcc-bugzilla@gcc.gnu.org
Wed Oct 17 14:37:00 GMT 2012


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

             Bug #: 54951
           Summary: Incorrect pointer handling on 32K boundary
    Classification: Unclassified
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: m.galante@centrosistemi.it


Created attachment 28460
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28460
Simple test case to reproduce the bug

m32c-elf-gcc (GCC) 4.7.2 hosted on Windows XP.

The attached "run.bat" batch compiles and runs a simple program that adds a
constant value (COUNT) to a pointer (0x10000) and prints the result.
The first result (a) is calculated by adding COUNT to the pointer, the second
result (b) is calculated by incrementing the pointer COUNT times.

When COUNT is 0x7FFF the result is correct for both a and b (0x17FFF).

When COUNT is 0x8000 the result is incorrect for a (0x8000) but correct for b
(0x18000).

When COUNT is 0xFFFF the result is incorrect for a (0xFFFF) but correct for b
(0x1FFFF) when compiled with -O0, and incorrect for both a and b (0xFFFF) when
compiled with -O1.



More information about the Gcc-bugs mailing list