[Bug c/27214] New: The C frontend introduces undefined pointer overflow
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Apr 19 11:44:00 GMT 2006
The C frontend creates pointer arithmetic that assumes that pointer
overflow is defined (and wraps).
char *foo(char *p)
{
return p + -4;
}
results in
foo (p)
{
char * D.1523;
D.1523 = p + -4B;
return D.1523;
}
this is via c-common.c:pointer_int_sum().
<plus_expr 0xb7da4144
type <pointer_type 0xb7db405c
type <integer_type 0xb7dac170 char public string-flag QI
size <integer_cst 0xb7d9d1f8 constant invariant 8>
unit size <integer_cst 0xb7d9d210 constant invariant 1>
align 8 symtab 0 alias set -1 precision 8 min <integer_cst
0xb7d9d258 -128> max <integer_cst 0xb7d9d2b8 127>
pointer_to_this <pointer_type 0xb7db405c>>
unsigned SI
size <integer_cst 0xb7d9d3f0 constant invariant 32>
unit size <integer_cst 0xb7d9d180 constant invariant 4>
align 32 symtab 0 alias set -1>
arg 0 <parm_decl 0xb7da5140 p type <pointer_type 0xb7db405c>
used unsigned SI file t.c line 1 size <integer_cst 0xb7d9d3f0 32> unit
size <integer_cst 0xb7d9d180 4>
align 32 context <function_decl 0xb7e2d980 foo> initial <pointer_type
0xb7db405c> arg-type <pointer_type 0xb7db405c>>
arg 1 <integer_cst 0xb7e35eb8 type <pointer_type 0xb7db405c> constant
invariant 4294967292>>
--
Summary: The C frontend introduces undefined pointer overflow
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at gcc dot gnu dot org
OtherBugsDependingO 27039
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27214
More information about the Gcc-bugs
mailing list