[Bug c++/50608] [4.6/4.7 regression] cannot apply 'offsetof' to a non-constant address

ebotcazou at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Nov 4 21:46:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50608

--- Comment #6 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2011-11-04 21:46:10 UTC ---
Author: ebotcazou
Date: Fri Nov  4 21:46:07 2011
New Revision: 180986

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180986
Log:
2011-11-04  Eric Botcazou  <ebotcazou@adacore.com>

    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.
c-family/
    * 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.
cp/
    * semantics.c (finish_offsetof): Adjust call to fold_offsetof.
    * typeck.c (cp_build_addr_expr_1): Call fold_offsetof_1.

Added:
    trunk/gcc/testsuite/g++.dg/other/offsetof7.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-parser.c
    trunk/gcc/c-typeck.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/cp/typeck.c
    trunk/gcc/testsuite/ChangeLog



More information about the Gcc-bugs mailing list