[Bug c++/57555] New: Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-07 Thread megari at mbnet dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555

Bug ID: 57555
   Summary: Warning on negation of constexpr uint8_t being
assigned to uint8_t
   Product: gcc
   Version: 4.7.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: megari at mbnet dot fi

The following code produces a warning when it probably should not:

$ cat constexprbug.cpp
#include cstdint

uint8_t foo() {
static constexpr uint8_t foo = 0xff;

uint8_t ret = ~foo;

return ret;
}

uint8_t bar() {
static constexpr uint8_t foo = 0x00;

uint8_t ret = ~foo;

return ret;
}

int main() {
foo();
bar();
}

$ g++ -std=c++11 -o constexprbug constexprbug.cpp
constexprbug.cpp: In function ‘uint8_t foo()’:
constexprbug.cpp:6:20: warning: large integer implicitly truncated to unsigned
type [-Woverflow]
$ gcc --version
gcc (GCC) 4.7.2 20120921 (Red Hat 4.7.2-2)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The curious thing is that only the function foo() produces the warning. Also,
the variable needs to be constexpr for the warning to be emitted.

[Bug c++/57555] Warning on negation of constexpr uint8_t being assigned to uint8_t

2013-06-07 Thread megari at mbnet dot fi
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555

--- Comment #1 from Ari Sundholm megari at mbnet dot fi ---
It seems that actually just making the variable const suffices:

uint8_t foo() {
static const uint8_t foo = 0xff;

uint8_t ret = ~foo;

return ret;
}


[Bug c/35899] New: ICE on filesystem code

2008-04-10 Thread megari at mbnet dot fi
I get an ICE on some filesystem code I'm developing when trying to compile it
with GCC 4.3.0.

[EMAIL PROTECTED]:~/gcc-bug$ gcc-4.3 -v -save-temps -o sfs_unittests.o  -O2 -g 
-I.
-std=c99 -Wall -W -c sfs_unittests.c 
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure linux gnu
Thread model: posix
gcc version 4.3.1 20080401 (prerelease) (Debian 4.3.0-3) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'sfs_unittests.o' '-O2' '-g' '-I.'
'-std=c99' '-Wall' '-W' '-c' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.1/cc1 -E -quiet -v -I. sfs_unittests.c
-mtune=generic -std=c99 -Wall -W -fworking-directory -O2 -fpch-preprocess -o
sfs_unittests.i
ignoring nonexistent directory /usr/local/include/i486-linux-gnu
ignoring nonexistent directory
/usr/lib/gcc/i486-linux-gnu/4.3.1/../../../../i486-linux-gnu/include
ignoring nonexistent directory /usr/include/i486-linux-gnu
#include ... search starts here:
#include ... search starts here:
 .
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.3.1/include
 /usr/lib/gcc/i486-linux-gnu/4.3.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-o' 'sfs_unittests.o' '-O2' '-g' '-I.'
'-std=c99' '-Wall' '-W' '-c' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.1/cc1 -fpreprocessed sfs_unittests.i -quiet
-dumpbase sfs_unittests.c -mtune=generic -auxbase-strip sfs_unittests.o -g -O2
-Wall -W -std=c99 -version -o sfs_unittests.s
GNU C (Debian 4.3.0-3) version 4.3.1 20080401 (prerelease) (i486-linux-gnu)
compiled by GNU C version 4.3.1 20080401 (prerelease), GMP version
4.2.2, MPFR version 2.3.1.
warning: GMP header version 4.2.2 differs from library version 4.2.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c8e3951360ed7273beac0a50e7fd5f3d
In file included from sfs_unittests.c:4:
fs/sfs_xplatform.h: In function ‘sfs_write_file’:
fs/sfs_xplatform.h:130: warning: implicit declaration of function
‘sfs_native_write_block’
fs/sfs_xplatform.h:148: warning: implicit declaration of function
‘sfs_native_read_block’
sfs_unittests.c: At top level:
sfs_unittests.c:5: warning: conflicting types for ‘sfs_native_write_block’
fs/sfs_xplatform.h:130: warning: previous implicit declaration of
‘sfs_native_write_block’ was here
sfs_unittests.c:11: warning: conflicting types for ‘sfs_native_read_block’
fs/sfs_xplatform.h:148: warning: previous implicit declaration of
‘sfs_native_read_block’ was here
sfs_unittests.c: In function ‘printbl’:
sfs_unittests.c:18: warning: implicit declaration of function ‘printf’
sfs_unittests.c:18: warning: incompatible implicit declaration of built-in
function ‘printf’
sfs_unittests.c: In function ‘main’:
sfs_unittests.c:64: warning: incompatible implicit declaration of built-in
function ‘printf’
fs/sfs_xplatform.h: In function ‘sfs_remove_bytes’:
fs/sfs_xplatform.h:250: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See file:///usr/share/doc/gcc-4.3/README.Bugs for instructions.
[EMAIL PROTECTED]:~/gcc-bug$


-- 
   Summary: ICE on filesystem code
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: megari at mbnet dot fi


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



[Bug c/35899] ICE on filesystem code

2008-04-10 Thread megari at mbnet dot fi


--- Comment #1 from megari at mbnet dot fi  2008-04-10 12:09 ---
Created an attachment (id=15464)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15464action=view)
Preprocessed source


-- 


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