This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
Found when attempting to compile powerpc64-linux glibc using current mainline gcc, the attached cut-down testcase results in tcboff.i: In function 'dummy': tcboff.i:24: warning: asm operand 0 probably doesn't match constraints tcboff.i:24: error: impossible constraint in 'asm'
Created an attachment (id=8106) [edit] testcase
The problem is that we don't fold "&4294938544B->D.1116.header.multiple_threads" to the offset but I remember there was a reason why we don't. The reason why this works in 3.4.4 is that we "fold' that in the front-end before getting anywhere.
The easiest fix would be to fold it in the front-end for all INT_CST's like the following with a slight comment fix above: Index: c-typeck.c =============================================================== ==== RCS file: /cvs/gcc/gcc/gcc/c-typeck.c,v retrieving revision 1.415 diff -u -p -r1.415 c-typeck.c --- c-typeck.c 29 Jan 2005 16:12:38 -0000 1.415 +++ c-typeck.c 30 Jan 2005 14:13:00 -0000 @@ -2683,7 +2683,7 @@ build_unary_op (enum tree_code code, tre when we have proper support for integer constant expressions. */ val = get_base_address (arg); if (val && TREE_CODE (val) == INDIRECT_REF - && integer_zerop (TREE_OPERAND (val, 0))) + && TREE_CODE (TREE_OPERAND (val, 0)) == INTEGER_CST) return fold_convert (argtype, fold_offsetof (arg)); val = build1 (ADDR_EXPR, argtype, arg);
: Search converges between 2004-08-30-trunk (#529) and 2004-08-31-trunk (#530).
Andrew, your patch is wrong; fold_offsetof assumes a zero base. Alan, I have no particular interest in fixing this. See how the alpha tcb-offsets.def file addresses this same problem. If this turns out to be Absolutely Necessary, ie affects more than just the nptl build, we can consider adding more hacks in this area to accomodate, but at present I just don't think it's worth it.