public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108398] New: tree-object-size trips up with pointer arithmetic if an intermediate result is an invalid pointer
@ 2023-01-13 17:41 siddhesh at gcc dot gnu.org
  2023-01-13 17:51 ` [Bug tree-optimization/108398] " law at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: siddhesh at gcc dot gnu.org @ 2023-01-13 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108398
           Summary: tree-object-size trips up with pointer arithmetic if
                    an intermediate result is an invalid pointer
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
  Target Milestone: ---

Reproducer:

unsigned steps[2];

int main(void) {
    for (unsigned *io = steps; 0 < sizeof (steps) / sizeof (unsigned); io++) {
        if (*io == 0) {
            if (__builtin_dynamic_object_size (io, 0) != sizeof (unsigned))
                __builtin_abort ();
            io--;
        }
    }

    return 0;
}

$ gcc -O1 prima.c -o prima
$ ./prima
Aborted (core dumped)

io may momentarily point before steps, which is what seems to trip up
tree-object-size.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-01-15 11:20 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 17:41 [Bug tree-optimization/108398] New: tree-object-size trips up with pointer arithmetic if an intermediate result is an invalid pointer siddhesh at gcc dot gnu.org
2023-01-13 17:51 ` [Bug tree-optimization/108398] " law at gcc dot gnu.org
2023-01-13 18:08 ` siddhesh at gcc dot gnu.org
2023-01-13 18:24 ` siddhesh at gcc dot gnu.org
2023-01-13 18:30 ` jakub at gcc dot gnu.org
2023-01-13 19:51 ` siddhesh at gcc dot gnu.org
2023-01-13 19:52 ` yann at droneaud dot fr
2023-01-13 19:55 ` siddhesh at gcc dot gnu.org
2023-01-13 19:58 ` jakub at gcc dot gnu.org
2023-01-13 20:25 ` siddhesh at gcc dot gnu.org
2023-01-15 11:20 ` yann at droneaud dot fr

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).