public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23544] New: behavour by expression with unsigned variables in if-statement is not like expected
@ 2005-08-24 9:09 tobias dot leutwein at bosch dot com
2005-08-24 11:37 ` [Bug c/23544] " tobias dot leutwein at bosch dot com
0 siblings, 1 reply; 2+ messages in thread
From: tobias dot leutwein at bosch dot com @ 2005-08-24 9:09 UTC (permalink / raw)
To: gcc-bugs
void main(void)
{
unsigned short v1, v2, e1;
v1 = 6;
v2 = 8;
if ( v1 - v2 < 2 )
{
/* this is not the expected behaviour */
e1 = v1 - v2;
}
}
I would expect that v1-v2 in the if statement is 65534. It seems to be that
v1-v2 in the if statement gets (-2) and so the condition is true.
Compiling: V:/tmp/compiler-fehler/src/main.c
cd V:/tmp/compiler-fehler/makeout/obj; \
V:/Programme/MinGW/bin/gcc -v -c -g -std=gnu99 -IV:/tmp/com
piler-fehler/src -DPROJECT_H="<project.h>" -DSTDTYPE_H="<stdtype.h>" -D__AVR_ATm
ega32__=1 -fno-common -fverbose-asm -O0 -Wall -Wbad-function-cast -Wcast-align -
Winline -Wmissing-declarations -Wmissing-noreturn -Wmissing-prototypes -Wnested-
externs -Wno-comment -Wno-unused-function -Wpacked -Wpointer-arith -Wstrict-prot
otypes -Wp,-M,-MP,-MT,V:/tmp/compiler-fehler/makeout/obj/main.o,-MF,V:/tmp/comp
iler-fehler/makeout/dep/main.d V:/tmp/compiler-fehler/src/main.c -o main.o;
Reading specs from v:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable
-languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e
nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-ja
va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroniz
ation --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.2 (mingw-special)
v:/Programme/MinGW/bin/../libexec/gcc/mingw32/3.4.2/cc1.exe -quiet -v -IV:/tmp/
compiler-fehler/src -iprefix v:\Programme\MinGW\bin\../lib/gcc/mingw32/3.4.2/ -D
PROJECT_H=<project.h> -DSTDTYPE_H=<stdtype.h> -D__AVR_ATmega32__=1 -M -MP -MT V:
/tmp/compiler-fehler/makeout/obj/main.o -MF V:/tmp/compiler-fehler/makeout/dep/m
ain.d V:/tmp/compiler-fehler/src/main.c -quiet -dumpbase main.c -auxbase-strip m
ain.o -g -O0 -Wall -Wbad-function-cast -Wcast-align -Winline -Wmissing-declarati
ons -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wno-comment -Wno-u
nused-function -Wpacked -Wpointer-arith -Wstrict-prototypes -std=gnu99 -version
-fno-common -fverbose-asm -o c:\TEMP/ccwzaaaa.s
ignoring nonexistent directory "v:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/
../../../../mingw32/include"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/include"
ignoring nonexistent directory "/mingw/lib/gcc/mingw32/3.4.2/include"
ignoring nonexistent directory "/mingw/mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
V:/tmp/compiler-fehler/src
v:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include
v:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/include
End of search list.
GNU C version 3.4.2 (mingw-special) (mingw32)
compiled by GNU C version 3.4.2 (mingw-special).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=131001
V:/tmp/compiler-fehler/src/main.c:2: warning: return type of 'main' is not `int'
v:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../mingw32/bin/as.exe
-o main.o c:\TEMP/ccwzaaaa.s
--
Summary: behavour by expression with unsigned variables in if-
statement is not like expected
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot leutwein at bosch dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-mingw32
GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23544
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/23544] behavour by expression with unsigned variables in if-statement is not like expected
2005-08-24 9:09 [Bug c/23544] New: behavour by expression with unsigned variables in if-statement is not like expected tobias dot leutwein at bosch dot com
@ 2005-08-24 11:37 ` tobias dot leutwein at bosch dot com
0 siblings, 0 replies; 2+ messages in thread
From: tobias dot leutwein at bosch dot com @ 2005-08-24 11:37 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From tobias dot leutwein at bosch dot com 2005-08-24 10:54 -------
Example is wrong.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23544
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-08-24 10:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-24 9:09 [Bug c/23544] New: behavour by expression with unsigned variables in if-statement is not like expected tobias dot leutwein at bosch dot com
2005-08-24 11:37 ` [Bug c/23544] " tobias dot leutwein at bosch 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).