This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50608] [4.6/4.7 regression] cannot apply 'offsetof' to a non-constant address
- From: "amker at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Jun 2012 03:11:03 +0000
- Subject: [Bug c++/50608] [4.6/4.7 regression] cannot apply 'offsetof' to a non-constant address
- Auto-submitted: auto-generated
- References: <bug-50608-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50608
--- Comment #9 from amker at gcc dot gnu.org 2012-06-12 03:11:03 UTC ---
Author: amker
Date: Tue Jun 12 03:10:55 2012
New Revision: 188418
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188418
Log:
Backport r180986 from mainline
2011-11-04 Eric Botcazou <ebotcazou@adacore.com>
PR c++/50608
* c-common.c (c_fully_fold_internal) <ADDR_EXPR>: Call fold_offsetof_1.
(fold_offsetof_1): Make global. Remove STOP_REF argument and adjust.
<INDIRECT_REF>: Return the argument.
<ARRAY_REF>: Remove special code for negative offset.
Call fold_build_pointer_plus instead of size_binop.
(fold_offsetof): Remove STOP_REF argument and adjust.
* c-common.h (fold_offsetof_1): Declare.
(fold_offsetof): Remove STOP_REF argument.
PR c++/50608
* c-parser.c (c_parser_postfix_expression) <RID_OFFSETOF>: Adjust call
to fold_offsetof.
* c-typeck.c (build_unary_op) <ADDR_EXPR>: Call fold_offsetof_1.
* g++.dg/other/offsetof7.C: New test.
PR c++/50608
* semantics.c (finish_offsetof): Adjust call to fold_offsetof.
* typeck.c (cp_build_addr_expr_1): Call fold_offsetof_1.
Added:
branches/ARM/embedded-4_6-branch/gcc/c-family/ChangeLog.arm
branches/ARM/embedded-4_6-branch/gcc/cp/ChangeLog.arm
branches/ARM/embedded-4_6-branch/gcc/testsuite/g++.dg/other/offsetof7.C
Modified:
branches/ARM/embedded-4_6-branch/gcc/ChangeLog.arm
branches/ARM/embedded-4_6-branch/gcc/c-family/c-common.c
branches/ARM/embedded-4_6-branch/gcc/c-family/c-common.h
branches/ARM/embedded-4_6-branch/gcc/c-parser.c
branches/ARM/embedded-4_6-branch/gcc/c-typeck.c
branches/ARM/embedded-4_6-branch/gcc/cp/semantics.c
branches/ARM/embedded-4_6-branch/gcc/cp/typeck.c
branches/ARM/embedded-4_6-branch/gcc/testsuite/ChangeLog.arm