This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/21541] [4.1 Regression] gcc.c-torture/execute/20031215-1.c compilation fails
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2005 18:28:10 -0000
- Subject: [Bug tree-optimization/21541] [4.1 Regression] gcc.c-torture/execute/20031215-1.c compilation fails
- References: <20050512200450.21541.jsm28@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From rguenth at gcc dot gnu dot org 2005-05-14 18:28 -------
gimplify_expr calls fold_indirect_ref on *(char *)&ao.ch which happily folds
away the cast. Disabling fold_indirect_ref leaves the stripping to
STRIP_USELESS_TYPE_CONVERSION, so we end up with
const char * D.1237;
D.1237 = &ao.ch;
*D.1237 = 1;
resulting from gimplify_expr (
<nop_expr 0x401462c0
type <pointer_type 0x40156bd0
type <integer_type 0x401493cc char public QI
size <integer_cst 0x40141210 constant invariant 8>
unit size <integer_cst 0x40141228 constant invariant 1>
align 8 symtab 0 alias set -1 precision 8 min <integer_cst
0x40141270 -128> max <integer_cst 0x401412d0 127>
pointer_to_this <pointer_type 0x40156bd0>>
unsigned SI
size <integer_cst 0x40141408 constant invariant 32>
unit size <integer_cst 0x40141198 constant invariant 4>
align 32 symtab 0 alias set -1>
readonly constant invariant
arg 0 <addr_expr 0x401462a0
type <pointer_type 0x4015821c type <integer_type 0x401581b0 char>
unsigned SI size <integer_cst 0x40141408 32> unit size <integer_cst
0x40141198 4>
align 32 symtab 0 alias set -1
pointer_to_this <pointer_type 0x4015857c>>
readonly constant invariant
arg 0 <component_ref 0x4014e078 type <integer_type 0x401493cc char>
readonly arg 0 <var_decl 0x401be000 ao> arg 1 <field_decl 0x401b7dec
ch>>>>
)
and tree_ssa_useless_type_conversion_1 tells us that the conversion from
<pointer_type 0x4015821c
type <integer_type 0x401581b0 char readonly QI
size <integer_cst 0x40141210 constant invariant 8>
unit size <integer_cst 0x40141228 constant invariant 1>
align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0x40141270
-128> max <integer_cst 0x401412d0 127>
pointer_to_this <pointer_type 0x4015821c>>
unsigned SI
size <integer_cst 0x40141408 type <integer_type 0x40149288 bit_size_type>
constant invariant 32>
unit size <integer_cst 0x40141198 type <integer_type 0x4014921c unsigned
int> constant invariant 4>
align 32 symtab 0 alias set -1
pointer_to_this <pointer_type 0x4015857c>>
to
<pointer_type 0x40156bd0
type <integer_type 0x401493cc char public QI
size <integer_cst 0x40141210 constant invariant 8>
unit size <integer_cst 0x40141228 constant invariant 1>
align 8 symtab 0 alias set -1 precision 8 min <integer_cst 0x40141270
-128> max <integer_cst 0x401412d0 127>
pointer_to_this <pointer_type 0x40156bd0>>
unsigned SI
size <integer_cst 0x40141408 type <integer_type 0x40149288 bit_size_type>
constant invariant 32>
unit size <integer_cst 0x40141198 type <integer_type 0x4014921c unsigned
int> constant invariant 4>
align 32 symtab 0 alias set -1>
is useless because c_types_compatible_p in turn thinks "char" and "const char"
are compatible because they share the same TYPE_MAIN_VARIANT "char".
So we finally strip the NOP_EXPR doing the cast to char* from const char*.
If we disable that part of tree_ssa_useless_type_conversion_1, we don't ICE
any longer, but alias1 still does not insert V_MAY_DEFs here and dce1 finally
deletes the store. Which may be a valid optimization; .t17.alias1:
test1 ()
{
char * D.1237;
<bb 0>:
D.1237_1 = (char *) &ao.ch;
# VUSE <SFT.0_2>;
*D.1237_1 = 1;
return;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21541