testcase: the following declaration causes a reading NULL pointer dereference. union u { char *p; } __attribute__ ((transparent_union)); diff -c -p gcc-2.7.0/ChangeLog gcc-2.7.0-x/ChangeLog *** gcc-2.7.0/ChangeLog Sat Jul 8 01:54:05 1995 --- gcc-2.7.0-x/ChangeLog Fri Jul 14 07:36:16 1995 *************** *** 1,3 **** --- 1,14 ---- + Fri Jul 14 07:34:21 1995 J"orn Rennecke (amylaar@meolyon.hanse.de) + * c-decl.c(finish_struct): wait with decl_attributes() till + TYPE_FIELDS (t) is valid. + + Thu Jul 13 22:53:04 1995 J"orn Rennecke (amylaar@meolyon.hanse.de) + * c-common.c(decl_attributes): bug fix for A_ALIGNED + + Sat Jul 8 10:33:59 1995 J"orn Rennecke (amylaar@meolyon.hanse.de) + * New optimization option -fomit-default-branch . Most of it + is in expand_end_case(). Doc in gcc.1 + Fri Jun 16 06:54:03 1995 Richard Kenner (kenner@vlsi1.ultra.nyu.edu) * alpha.c (alpha_builtin_saveregs): Use ptr_mode and conversions diff -c -p gcc-2.7.0/c-decl.c gcc-2.7.0-x/c-decl.c *** gcc-2.7.0/c-decl.c Sat Jul 8 01:54:16 1995 --- gcc-2.7.0-x/c-decl.c Fri Jul 14 07:30:19 1995 *************** finish_struct (t, fieldlist, attributes) *** 5407,5414 **** TYPE_SIZE (t) = 0; - decl_attributes (t, attributes, NULL_TREE); - /* Nameless union parm types are useful as GCC extension. */ if (! (TREE_CODE (t) == UNION_TYPE && TYPE_NAME (t) == 0) && !pedantic) /* Otherwise, warn about any struct or union def. in parmlist. */ --- 5407,5412 ---- *************** finish_struct (t, fieldlist, attributes) *** 5585,5590 **** --- 5583,5591 ---- then lay out the structure or union (including the fields). */ TYPE_FIELDS (t) = fieldlist; + + /* attribute transparent_union reads TYPE_FIELDS */ + decl_attributes (t, attributes, NULL_TREE); layout_type (t); ----- end of diff ----