For the attached (unfortunately rather lengthy) file I finally managed to get a reproducible testcase that spews out several pages of canonical types warning messages when compiled with -O2 (but not with -O0):
examples/step-27> /tmp/bangerth/bin/gcc-mainline/bin/g++ -c step-27.ii -O2 step-27.cc: In member function 'void LaplaceProblem<dim>::create_coarse_grid() [with int dim = 2]': step-27.cc:742: warning: same canonical type node for different types dealii::Point<2> [24] and const dealii::Point<2> [24] <array_type 0xb4cef8dc type <record_type 0xb7459bd0 Point sizes-gimplified addressable needs-constructing type_1 type_5 type_6 BLK size <integer_cst 0xb7d5e834 constant invariant 128> unit size <integer_cst 0xb7d5e850 constant invariant 16> align 32 symtab 0 alias set 147 canonical type 0xb7459bd0 fields <field_decl 0xb5f54a20 D.74077 type <record_type 0xb745472c Tensor> ignored decl_6 BLK file /tmp/bangerth/x/deal.II/base/include/base/tensor_base.h line 39 size <integer_cst 0xb7d5e834 128> unit size <integer_cst 0xb7d5e850 16> align 32 offset_align 128 offset <integer_cst 0xb7d5e444 constant invariant 0> bit offset <integer_cst 0xb7d5eb28 constant invariant 0> context <record_type 0xb7459bd0 Point> chain <type_decl 0xb5f8a438 Point>> context <namespace_decl 0xb7e25870 dealii> needs-constructor X() X(constX&) this=(X&) n_parents=1 use_template=1 interface-unknown pointer_to_this <pointer_type 0xb5f8a510> reference_to_this <reference_type 0xb5f8e0d8> chain <type_decl 0xb7459c3c Point>> sizes-gimplified needs-constructing BLK ... I hope this helps to track a few things down. I have a couple of other files that show canonical types fail as well, but there the bug goes away once one uses -save-temps :-( Best Wolfgang -- Summary: Canonical types failures Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: bangerth at dealii dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31505