[Bug c++/56123] Union bitfield corruption

2013-01-27 Thread timj at gtk dot org


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



Tim Janik  changed:



   What|Removed |Added



 Status|UNCONFIRMED |RESOLVED

 Resolution||INVALID



--- Comment #2 from Tim Janik  2013-01-28 01:39:40 UTC ---

Thanks for the quick answer Jon, you're right indeed, from the C99 spec:



> If insufficient space remains, whether a bit-field that does not fit is put 
> into the next unit or overlaps adjacent units is implementation-defined.


[Bug libstdc++/55911] Segfault in unordered_map with max_load_factor > 1

2013-01-27 Thread timj at gtk dot org


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



--- Comment #7 from Tim Janik  2013-01-28 01:13:04 UTC ---

(In reply to comment #4)

> Debug Mode even catches it:

> 

> unordered_map:max_size: 576460752303423487

> unordered_map:size: 10352716

> unordered_map:bucket_count: 218971

> unordered_map: load_factor: 47.278938

> unordered_map: max_load_factor: 50.00

> /home/wakelj/tools/Linux-f12-x86_64/4.8/include/c++/4.8.0/debug/unordered_map:229:

> error: attempt to access container with out-of-bounds bucket index

> 218971, container only holds 218971 buckets.

> 

> Objects involved in the operation:

> sequence "this" @ 0x0x7fffd8ae2810 {

>   type = NSt7__debug13unordered_mapIld11HashPtrdiffSt8equal_toIlESaIlEEE;

> }

> Aborted (core dumped)



Thanks, I'm impressed to see that.

How did you get that message? Just using g++-4.7 -D_GLIBCXX_DEBUG still gives

me the segfault.


[Bug c++/56123] New: Union bitfield corruption

2013-01-27 Thread timj at gtk dot org


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



 Bug #: 56123

   Summary: Union bitfield corruption

Classification: Unclassified

   Product: gcc

   Version: unknown

Status: UNCONFIRMED

  Severity: major

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: t...@gtk.org





Created attachment 29287

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29287

test case with assertion triggered



In this union

union {

  size_t   vsize;

  struct {   

uint   field24 : 24;

uint   unused : 24;

uint   field16 : 16;

  };

};

"field16" accesses are mismangled, depending on wether "unused" has 24 bits or

is split into two 8+16 components. 

Test case is attached, test it with and without -DNOBUG.



Occours on a 64bit platform with g++-4.6 and 4.7:

$ g++-4.7 --version

g++-4.7 (Ubuntu/Linaro 4.7.2-11precise2) 4.7.2

$ uname -a

Linux jumper 3.2.0-36-generic #57-Ubuntu SMP Tue Jan 8 21:44:52 UTC 2013 x86_64

x86_64 x86_64 GNU/Linux


[Bug libstdc++/55911] New: Segfault in unordered_map with max_load_factor > 1

2013-01-08 Thread timj at gtk dot org


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



 Bug #: 55911

   Summary: Segfault in unordered_map with max_load_factor > 1

Classification: Unclassified

   Product: gcc

   Version: 4.7.2

Status: UNCONFIRMED

  Severity: major

  Priority: P3

 Component: libstdc++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: t...@gtk.org





Created attachment 29114

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29114

C++11 unordered_map segfault example



The attached test program segfaults when compiled and executed with the

following g++ versions:

g++-4.7 (Ubuntu/Linaro 4.7.2-11precise2) 4.7.2

g++-4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3



The program inserts values into an unordered_map and iterates over it's bucket

stats. Removing the line

> pmap.max_load_factor (50);

does not cause a segfault.



Example output:

$ g++ -g -Wall -O2 -std=gnu++0x -pthread umap-bug.cc && dbg ./a.out 

unordered_map:max_size: 768614336404564650

unordered_map:size: 10352716

unordered_map:bucket_count: 218971

unordered_map: load_factor: 47.278938

unordered_map: max_load_factor: 50.00



Program received signal SIGSEGV, Segmentation fault.

__distance,

false, false> > (__last=..., __first=...)

at /usr/include/c++/4.6/bits/stl_iterator_base_funcs.h:82

82++__first;

(gdb) bt

#0  __distance, false, false> > (__last=..., __first=...)

at /usr/include/c++/4.6/bits/stl_iterator_base_funcs.h:82

#1  distance,

false, false> > (__last=..., __first=...)

at /usr/include/c++/4.6/bits/stl_iterator_base_funcs.h:117

#2  bucket_size (__n=218971, this=0x7fffde30) at

/usr/include/c++/4.6/bits/hashtable.h:299

#3  unordered_map_bucket_stats >

(umap=...) at umap-bug.cc:16

#4  main (argc=, argv=) at umap-bug.cc:55


[Bug c++/50456] New: attributes ignored on member templates

2011-09-19 Thread timj at gtk dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50456

 Bug #: 50456
   Summary: attributes ignored on member templates
Classification: Unclassified
   Product: gcc
   Version: 4.5.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: t...@gtk.org


Decorating a member template with __attribute__((error)) should trigger
compiler errors like declaring regular methods does. (A similar bug exists
about __attribute__((warning))).
Example code:

template struct Object;
template<> struct Object {
  template static void
  should_error (A a)
__attribute__ ((error ("Calling this function should trigger a compiler
error")))
;
};
int main (int argc, char *argv[]) {
  typedef Object FloatObject;
  FloatObject::should_error (7);
  return 0;
}
// g++ -Wall -O2 x.cc && ./a.out  

Actual result:
x.cc:(.text+0xa): undefined reference to `void
Object::should_error(int)'

Expected result:
x.cc:10: error: call to ‘Object::should_error’ declared with attribute
error: Calling this function should trigger a compiler error

Observed with g++-4.4 and g++-4.5 (Ubuntu/Linaro 4.5.1-7ubuntu2) 4.5.1.


[Bug c++/34750] ICE in fold_convert, at fold-const.c:1955

2008-01-12 Thread timj at gtk dot org


--- Comment #1 from timj at gtk dot org  2008-01-12 15:34 ---
Created an attachment (id=14929)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14929&action=view)
compressed C++ preprocessor output

the preprocessed code was spewed out by gcc in the middle of development, it is
not meant to do anything sensible. line directives have been stripped and it
was compressed with bzip2 to avoid inflating bugzilla with 3MB preprocessor
blobs.


-- 


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



[Bug c++/34750] New: ICE in fold_convert, at fold-const.c:1955

2008-01-12 Thread timj at gtk dot org
compiling gccfolderr.cc like this:
  g++-4.1 -g -Wall -Wdeprecated -Wno-cast-qual -pipe -O2 -ftracer \
-finline-functions -fno-keep-static-consts gccfolderr.cc
yields:
  gccfolderr.cc: In function ‘void::test_array()’:
  gccfolderr.cc:34571: internal compiler error: in fold_convert, at \
fold-const.c:1955

compiling it without options still results in an ICE:
  g++-4.1 gccfolderr.cc
albeit a different one:
  gccfolderr.cc:34571: internal compiler error: in cp_expr_size, at \
cp/cp-objcp-common.c:101

gcc version details (etch x86):
$ g++-4.1 --version
g++-4.1 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

compressed preprocessor file follows.


-- 
   Summary: ICE in fold_convert, at fold-const.c:1955
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: timj at gtk dot org


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



[Bug c++/30894] ICE in splice_child_die, at dwarf2out.c:5503

2007-02-20 Thread timj at gtk dot org


--- Comment #1 from timj at gtk dot org  2007-02-20 20:32 ---
Created an attachment (id=13077)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13077&action=view)
source code triggering ICE, use TRIGGER_ICE to toggle triggering


-- 


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



[Bug c++/30894] New: ICE in splice_child_die, at dwarf2out.c:5503

2007-02-20 Thread timj at gtk dot org
some C++ code in a project of mine triggers an ICE in various g++ versions:

$ g++-4.1 -g -Wall -Wdeprecated -Wno-cast-qual -pipe -O2 -ftracer
finline-functions -fno-keep-static-consts   -fPIC -DPIC  -c xice-uma.cc 
xice-uma.cc:71: internal compiler error: in splice_child_die, at
dwarf2out.c:5503
Please submit a full bug report,...

$ g++-4.1 --version
g++-4.1 (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
$ uname -a
Linux cruncher 2.6.17-10-generic #2 SMP Tue Dec 5 22:28:26 UTC 2006 i686
GNU/Linux

$ g++-4.0 xice-uma.cc 
xice-uma.cc: In member function ‘const AutoLocker::Locker* AutoLocker::locker()
const’:
xice-uma.cc:97: internal compiler error: Segmentation fault
$ g++-3.4 xice-uma.cc 
xice-uma.cc: In member function `const AutoLocker::Locker* AutoLocker::locker()
const':
xice-uma.cc:97: internal compiler error: Segmentation fault
$ g++-3.3 xice-uma.cc 
xice-uma.cc: In member function `const AutoLocker::Locker* AutoLocker::locker() 
   const':
xice-uma.cc:97: internal compiler error: Segmentation fault

i managed to shrink this down to a may_alias attribute on a union, source code
follows as xice-uma.cc.


-- 
   Summary: ICE in splice_child_die, at dwarf2out.c:5503
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: timj at gtk dot org


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



[Bug c++/27270] New: ICE in process_init_constructor_array, at cp/typeck2.c:788

2006-04-23 Thread timj at gtk dot org
with a recent gcc snapshot on i386:
  c++ (GCC) 4.2.0 20060325 (experimental)
the following tst program program:

template
struct Array {  
  Entry *array[32]; 
  Array () :
array ( (Entry*[1]) { 0, 0 } )  
  {}
};  
Array a;

compiled with:
  c++ -Wall arrayinit.cc
produces:
arrayinit.cc: In constructor 'Array::Array() [with Entry = void*]':
arrayinit.cc:8:   instantiated from here
arrayinit.cc:5: internal compiler error: in process_init_constructor_array, at
cp/typeck2.c:788
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.


-- 
   Summary: ICE in process_init_constructor_array, at
cp/typeck2.c:788
   Product: gcc
   Version: 4.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
    ReportedBy: timj at gtk dot org


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