[Bug target/46452] Apparently invalid optimization of bitfield access (4.5 regression?)
law at redhat dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 21 22:42:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46452
--- Comment #2 from Jeffrey A. Law <law at redhat dot com> 2011-02-21 22:14:15 UTC ---
Also note that the code will not compile with the current trunk of gcc as the
definition of struct lens triggers a long standing bug with anonymous members
which was fixed in the GCC 4.6 development cycle:
struct lens {
unsigned int ref;
enum lens_tag tag;
struct info *info;
struct regexp *ctype; /* NULL when recursive == 1 */
struct regexp *atype;
struct regexp *ktype;
struct regexp *vtype;
struct jmt *jmt; /* NULL when recursive == 0 */
unsigned int value : 1;
unsigned int key : 1;
unsigned int recursive : 1;
unsigned int consumes_value : 1;
/* Whether we are inside a recursive lens or outside */
unsigned int rec_internal : 1;
unsigned int ctype_nullable : 1;
union {
/* Primitive lenses */
struct { /* L_DEL uses both */
struct regexp *regexp; /* L_STORE, L_KEY */
struct string *string; /* L_VALUE, L_LABEL, L_SEQ, L_COUNTER */
};
/* Combinators */
struct lens *child; /* L_SUBTREE, L_STAR, L_MAYBE */
struct { /* L_UNION, L_CONCAT */
unsigned int nchildren;
struct lens **children;
};
struct {
struct lens *body; /* L_REC */
/* We represent a recursive lens as two instances of struct
* lens with L_REC. One has rec_internal set to 1, the other
* has it set to 0. The one with rec_internal is used within
* the body, the other is what is used from the 'outside'. This
* is necessary to break the cycles inherent in recursive
* lenses with reference counting. The link through alias is
* set up in lns_check_rec, and not reference counted.
*
* Generally, any lens used in the body of a recursive lens is
* marked with rec_internal == 1; lenses that use the recursive
* lens 'from the outside' are marked with rec_internal ==
* 0. In the latter case, we can assign types right away,
* except for the ctype, which we never have for any recursive
* lens.
*/
struct lens *alias;
struct jmt *jmt;
};
};
};
Note there is a "jmt" at the toplevel of the structure and also within the
anonymous sub struct. In the past GCC was too permissive in allowing this
situation to go unnoticed, GCC 4.6 will issue an error because reference to
jmt is ambiguous.
More information about the Gcc-bugs
mailing list