public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/46788] New: unsigned int possible treated as signed in a union/struct
@ 2010-12-03 15:38 tinokrauss at web dot de
  2010-12-03 16:26 ` [Bug c/46788] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: tinokrauss at web dot de @ 2010-12-03 15:38 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: unsigned int possible treated as signed in a
                    union/struct
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tinokrauss@web.de


Created attachment 22618
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22618
a module

When compiling the attached file the compiler does not warn, but the assambler
gives the following error:
C:\DOKUME~1\tkr\LOKALE~1\Temp\ccqr1SmQ.s: Assembler messages:
C:\DOKUME~1\tkr\LOKALE~1\Temp\ccqr1SmQ.s:522: Error: immediate value out of
range -- `movt r3,-32768'
The line "dwCalcVal.u_16_values.u_16_value_1=0x8000u;" causes the error.
It looks to me like a singned-unsigned fault and in fact it is so. reducing the
constant to a value 0x0000 till 0x7FFF will compile without error.
The problem appears also only when:
- the value is at the stack (local)
- the second value in struct is used (u_16_value_0 works fine).
GCC v 4.3.3 also works fine on the same code.

Configuarion:
-------------
PC Windows XP with Codesourcery, Target STM32F103 ARM-Controller
>arm-none-eabi-gcc.exe -v
Using built-in specs.
COLLECT_GCC=arm-none-eabi-gcc.exe
COLLECT_LTO_WRAPPER=c:/temp/codesourcery/bin/../libexec/gcc/arm-none-eabi/4.5.1/lto-wrapper.exe
Target: arm-none-eabi
Configured with:
/scratch/julian/2010q3-release-eabi-lite/src/gcc-4.5-2010.09/configure
--build=i686-pc-linux-gnu --host=i686-mingw32 --target=arm-none-eabi
--enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch
--enable-extra-sgxxlite-multilibs --with-gnu-as --with-gnu-ld
--with-specs='%{save-temps: -fverbose-asm} -D__CS_SOURCERYGXX_MAJ__=2010
-D__CS_SOURCERYGXX_MIN__=9 -D__CS_SOURCERYGXX_REV__=51
%{O2:%{!fno-remove-local-statics: -fremove-local-statics}}
%{O*:%{O|O0|O1|O2|Os:;:%{!fno-remove-local-statics: -fremove-local-statics}}}'
--enable-languages=c,c++ --disable-s
hared --enable-lto --with-newlib --with-pkgversion='Sourcery G++ Lite
2010.09-51' --with-bugurl=https://support.codesourcery.com/GNUToolchain/
--disable-nls --prefix=/opt/codesourcery --with-headers=yes
--with-sysroot=/opt/codesourcery/arm-none-eabi
--with-build-sysroot=/scratch/julian/2010q3-release-eabi-lite/install/host-i686-mingw32/arm-none-eabi
--with-libiconv-prefix=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-gmp=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-mpfr=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-mpc=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-ppl=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lst dc++,-Bdynamic -lm'
--with-cloog=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--with-libelf=/scratch/julian/2010q3-release-eabi-lite/obj/host-libs-2010.09-51-arm-none-eabi-i686-mingw32/usr
--disable-libgomp --enable-poison-system-directories
--with-build-time-tools=/scratch/julian/2010q3-release-eabi-lite/obj/tools-i686-pc-linux-gnu-2010.09-51-arm-none-eabi-i686-mingw32/arm-none-eabi/bin
--with-build-time-tools=/scratch/julian/2010q3-release-eabi-lite/obj/tools-i686-pc-linux-gnu-2010.09-51-arm-none-eabi-i686-mingw32/arm-none-eabi/bin
Thread model: single
gcc version 4.5.1 (Sourcery G++ Lite 2010.09-51)


Call-Parameters:
----------------
COLLECT_GCC_OPTIONS='-c' '-mcpu=cortex-m3' '-mthumb' '-mtune=cortex-m3'
'-mfix-cortex-m3-ldrd' '-mlong-calls' '-pedantic' '-mfpu=vfp'
'-mfloat-abi=soft' '-nostdinc' '-Os' '-DLITTLE_ENDIAN' '-v' '-gdwarf-2'
'-fmessage-length=0' '-mlittle-endian' '-fshort-enums' '-mno-thumb-interwork'
'-mstructure-size-boundary=8' '-fno-builtin' '-funsigned-bitfields'
'-Wcast-align' '-Wreturn-type' '-Wimplicit' '-Wunused' '-Wswitch'
'-Wuninitialized' '-o' 'E:\workspace_tkr\FSD-ELMA\trunk\out/SA1/ALGAac1.o'
'-D__CS_SOURCERYGXX_MAJ__=2010' '-D__CS_SOURCERYGXX_MIN__=9'
'-D__CS_SOURCERYGXX_REV__=51'
e:/toolhome/arm/codesourcery/v_4_5_1/bin/../lib/gcc/arm-none-eabi/4.5.1/../../../../arm-none-eabi/bin/as.exe
-v -EL -mcpu=cortex-m3 -mfloat-abi=soft -mfpu=vfp -meabi=5 -alhcdn -o
E:\workspace_tkr\FSD-ELMA\trunk\out/SA1/ALGAac1.o
C:\DOKUME~1\tkr\LOKALE~1\Temp\ccqr1SmQ.s
GNU assembler version 2.20.51 (arm-none-eabi) using BFD version (Sourcery G++
Lite 2010.09-51) 2.20.51.20100809


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

end of thread, other threads:[~2012-01-12 20:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
2010-12-03 16:26 ` [Bug c/46788] " rguenth at gcc dot gnu.org
2010-12-04 17:31 ` mikpe at it dot uu.se
2011-02-04 10:36 ` [Bug target/46788] " mikpe at it dot uu.se
2011-03-10 11:59 ` ramana at gcc dot gnu.org
2011-03-15 17:06 ` ramana at gcc dot gnu.org
2011-03-15 17:08 ` ramana at gcc dot gnu.org
2011-03-15 17:20 ` paolo.carlini at oracle dot com
2011-03-15 20:02 ` ramana at gcc dot gnu.org
2011-03-15 20:10 ` ramana at gcc dot gnu.org
2011-03-20 16:56 ` mikpe at it dot uu.se
2012-01-12 20:30 ` pinskia at gcc dot gnu.org

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).