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

* [Bug c/46788] unsigned int possible treated as signed in a union/struct
  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 ` rguenth at gcc dot gnu.org
  2010-12-04 17:31 ` mikpe at it dot uu.se
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2010-12-03 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2010-12-03 16:25:40 UTC ---
Please report to CodeSourcery or use a FSF version.


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

* [Bug c/46788] unsigned int possible treated as signed in a union/struct
  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
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu.se @ 2010-12-04 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #2 from Mikael Pettersson <mikpe at it dot uu.se> 2010-12-04 17:31:11 UTC ---
I can reproduce this with FSF gcc-4.5/4.6 and binutils-2.20.1 on
armv5tel-linux-gnueabi:

> gcc/xgcc -Bgcc -mcpu=cortex-m3 -mthumb -O2 -c MyFile.c
/tmp/ccCisNkW.s: Assembler messages:
/tmp/ccCisNkW.s:27: Error: immediate value out of range -- `movt r3,-32768'

With gcc-4.4 the error does not occur.


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  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 ` mikpe at it dot uu.se
  2011-03-10 11:59 ` ramana at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu.se @ 2011-02-04 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ramana at gcc dot gnu.org

--- Comment #3 from Mikael Pettersson <mikpe at it dot uu.se> 2011-02-04 10:35:43 UTC ---
It's caused by 150953:

Author: ramana
Date: Thu Aug 20 08:09:29 2009
New Revision: 150953

URL: http://gcc.gnu.org/viewcvs?root=3Dgcc&view=3Drev&rev=3D150953
Log:
Fix twolf ICE for ARM

2009-08-19  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>
            Richard Earnshaw  <richard.earnshaw@arm.com>

        * config/arm/arm.c (arm_emit_movpair): Handle CONST_INT.
        * config/arm/arm.md (*arm_movtas_ze): New pattern for
        movt.

You're missing an "#:upper16:" annotation in the *arm_movtas_ze pattern, c.f.
the *arm_movt pattern.

(Not posting a patch since my renewed attempt to get a copyright assignment
seems to have ended up in /dev/null over at the FSF.)


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (2 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-03-10 11:59 UTC (permalink / raw)
  To: gcc-bugs

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

Ramana Radhakrishnan <ramana at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.03.10 11:59:32
   Target Milestone|---                         |4.5.3
     Ever Confirmed|0                           |1

--- Comment #4 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-03-10 11:59:32 UTC ---
Confirmed


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (3 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-03-15 17:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-03-15 17:05:56 UTC ---
Author: ramana
Date: Tue Mar 15 17:05:51 2011
New Revision: 171002

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171002
Log:

Fixup last commit.

Fixed PR target/46788 and not PR 47688


Added:
    trunk/gcc/testsuite/gcc.target/arm/pr46788.c
      - copied unchanged from r171001,
trunk/gcc/testsuite/gcc.target/arm/pr47688.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (4 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-03-15 17:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-03-15 17:07:56 UTC ---

(In reply to comment #5)
> Author: ramana
> Date: Tue Mar 15 17:05:51 2011
> New Revision: 171002
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171002
> Log:
> 
> Fixup last commit.
> 
> Fixed PR target/46788 and not PR 47688
> 
> 
> Added:
>     trunk/gcc/testsuite/gcc.target/arm/pr46788.c
>       - copied unchanged from r171001,
> trunk/gcc/testsuite/gcc.target/arm/pr47688.c
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/testsuite/ChangeLog


This was fixed on trunk with this original commit followed by the commit in the
previous comment.


Author: ramana
Date: Tue Mar 15 16:14:21 2011
New Revision: 171000

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171000
Log:
Fix PR 47688

2011-03-18  Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>

    PR target/47668
    gcc/
    * config/arm/arm.md (arm_movtas_ze): Use 'L' instead of 'c'
    in the output template.
    gcc/testsuite/
    * gcc.target/arm/pr47688.c: New.

Added:
    trunk/gcc/testsuite/gcc.target/arm/pr47688.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/arm/arm.md
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (5 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-03-15 17:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-03-15 17:16:11 UTC ---
AFAICS, however, pr47688.c is still there.


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (6 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-03-15 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-03-15 19:59:29 UTC ---
Author: ramana
Date: Tue Mar 15 19:59:25 2011
New Revision: 171017

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171017
Log:

Fix PR target/46788


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gcc.target/arm/pr46788.c
      - copied unchanged from r171005,
trunk/gcc/testsuite/gcc.target/arm/pr46788.c
Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/config/arm/arm.md
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (7 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: ramana at gcc dot gnu.org @ 2011-03-15 20:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Ramana Radhakrishnan <ramana at gcc dot gnu.org> 2011-03-15 20:06:16 UTC ---
(In reply to comment #7)
> AFAICS, however, pr47688.c is still there.

I think I managed to delete it now even though I did do a svn rename.

Ramana


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (8 preceding siblings ...)
  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
  10 siblings, 0 replies; 12+ messages in thread
From: mikpe at it dot uu.se @ 2011-03-20 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Mikael Pettersson <mikpe at it dot uu.se> 2011-03-20 16:40:14 UTC ---
(In reply to comment #8)
> Author: ramana
> Date: Tue Mar 15 19:59:25 2011
> New Revision: 171017
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=171017
> Log:
> 
> Fix PR target/46788
> 
> 
> Added:
>     branches/gcc-4_6-branch/gcc/testsuite/gcc.target/arm/pr46788.c
>       - copied unchanged from r171005,
> trunk/gcc/testsuite/gcc.target/arm/pr46788.c
> Modified:
>     branches/gcc-4_6-branch/gcc/ChangeLog
>     branches/gcc-4_6-branch/gcc/config/arm/arm.md
>     branches/gcc-4_6-branch/gcc/testsuite/ChangeLog

The ChangeLog entry refers to PR 46778, it should refer to PR 46788.


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

* [Bug target/46788] unsigned int possible treated as signed in a union/struct
  2010-12-03 15:38 [Bug c/46788] New: unsigned int possible treated as signed in a union/struct tinokrauss at web dot de
                   ` (9 preceding siblings ...)
  2011-03-20 16:56 ` mikpe at it dot uu.se
@ 2012-01-12 20:30 ` pinskia at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-12 20:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

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

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-12 20:29:20 UTC ---
Fixed.


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