public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/114541] New: Invalid gimple __BB# accepted due to usage of atoi
@ 2024-04-01  4:50 pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2024-04-01  4:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114541

            Bug ID: 114541
           Summary: Invalid gimple __BB# accepted due to usage of atoi
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
            Blocks: 44574, 101057
  Target Milestone: ---

Take:
```

/* { dg-do compile } */
/* { dg-options "-O -fgimple" } */

void __GIMPLE (ssa,startwith ("dse2")) foo ()
{
  int a;

__BB(2):
  if (a_5(D) > 4)
    goto __BB4294967299;
  else
    goto __BB4;

__BB(3):
  a_2 = 10;
  goto __BB5;

__BB(4):
  a_3 = 20;
  goto __BB5;

__BB(5):
  a_1 = __PHI (__BB3: a_2, __BB4: a_3);
  a_4 = a_1 + 4;

return;
}

```

This is invalid gimple but the use of atoi in c_parser_gimple_parse_bb_spec
(c/gimple-parser.cc) allows to accept it.

Note also causes ICE if you put any invalid character after the number due to
use of BB 1 at that point (I think).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44574
[Bug 44574] Avoid use of atoi
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101057
[Bug 101057] [gimplefe] GIMPLE frontend issues

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-01  4:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-01  4:50 [Bug c/114541] New: Invalid gimple __BB# accepted due to usage of atoi pinskia 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).