Summary: | [4.0 Regression] does not fold "&int_cst->a" to just INT_CST | ||
---|---|---|---|
Product: | gcc | Reporter: | Alan Modra <amodra> |
Component: | middle-end | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED WONTFIX | ||
Severity: | normal | CC: | gcc-bugs |
Priority: | P2 | Keywords: | rejects-valid |
Version: | 4.0.0 | ||
Target Milestone: | 4.0.0 | ||
Host: | Target: | ||
Build: | Known to work: | 3.4.4 | |
Known to fail: | Last reconfirmed: | 2005-01-30 14:08:31 | |
Attachments: | testcase |
Description
Alan Modra
2005-01-30 10:46:19 UTC
Created attachment 8106 [details]
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. |