public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27214]  New: The C frontend introduces undefined pointer overflow
@ 2006-04-19 11:44 rguenth at gcc dot gnu dot org
  2006-04-19 15:06 ` [Bug c/27214] " pinskia at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-04-19 11:44 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <bug-27214-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-03-25 14:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-19 11:44 [Bug c/27214] New: The C frontend introduces undefined pointer overflow rguenth at gcc dot gnu dot org
2006-04-19 15:06 ` [Bug c/27214] " pinskia at gcc dot gnu dot org
2006-04-19 15:13 ` rguenth at gcc dot gnu dot org
2006-04-19 15:22 ` pinskia at gcc dot gnu dot org
2006-04-19 15:31 ` rguenth at gcc dot gnu dot org
2006-04-19 15:34 ` pinskia at gcc dot gnu dot org
2006-04-19 16:32 ` rakdver at gcc dot gnu dot org
2006-04-19 17:15 ` joseph at codesourcery dot com
2006-05-05  9:23 ` pinskia at gcc dot gnu dot org
2007-12-11  0:46 ` pinskia at gcc dot gnu dot org
2008-01-03 16:25 ` rguenth at gcc dot gnu dot org
     [not found] <bug-27214-4@http.gcc.gnu.org/bugzilla/>
2012-05-06  4:23 ` bugdal at aerifal dot cx
2012-05-07  9:21 ` rguenth at gcc dot gnu.org
2021-03-25 14:11 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).