public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108377] New: Unexpected 'exceeds maximum object size' diagnostic, wrong-code?
@ 2023-01-11 21:09 tschwinge at gcc dot gnu.org
  2023-01-11 21:19 ` [Bug tree-optimization/108377] " tschwinge at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: tschwinge at gcc dot gnu.org @ 2023-01-11 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108377
           Summary: Unexpected 'exceeds maximum object size' diagnostic,
                    wrong-code?
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tschwinge at gcc dot gnu.org
  Target Milestone: ---

Created attachment 54249
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54249&action=edit
1.c

Am I confused (it's late), or is GCC?  For '-O2' and higher:

    1.c: In function ‘f’:
    1.c:22:12: warning: argument 1 value ‘18446744073709551615’ exceeds maximum
object size 9223372036854775807 [-Walloc-size-larger-than=]
       22 |   needle = __builtin_malloc(n); /* { dg-bogus {exceeds maximum
object size} } */
          |            ^~~~~~~~~~~~~~~~~~~
    1.c:22:12: note: in a call to built-in allocation function
‘__builtin_malloc’

Manually reduced from some other test case.

Same issue for actual 'malloc', and 'size_t'.

This supposedly bogus 'needle' diagnostic disappears if I disable the
'haystack' allocation of 'n + 1'.

Actually, is this wrong-code?

    1.c.128t.sra:  _2 = __builtin_malloc (_1);
    1.c.128t.sra:  _5 = __builtin_malloc (n_14);

    1.c.129t.thread1:  _2 = __builtin_malloc (_1);
    1.c.129t.thread1:  _10 = __builtin_malloc (n_14);
    1.c.129t.thread1:  _5 = __builtin_malloc (n_14);

    1.c.130t.dom2:  _2 = __builtin_malloc (_1);
    1.c.130t.dom2:  _10 = __builtin_malloc (18446744073709551615);
    1.c.130t.dom2:  _5 = __builtin_malloc (n_14);

    [...]

    1.c.194t.fre5:  _2 = __builtin_malloc (_1);
    1.c.194t.fre5:  _10 = __builtin_malloc (18446744073709551615);
    1.c.194t.fre5:  _5 = __builtin_malloc (n_14);

    1.c.195t.thread2:  _2 = __builtin_malloc (_1);
    1.c.195t.thread2:  _10 = __builtin_malloc (18446744073709551615);
    1.c.195t.thread2:  _33 = __builtin_malloc (n_14);
    1.c.195t.thread2:  _5 = __builtin_malloc (n_14);

    1.c.196t.dom3:  _2 = __builtin_malloc (_1);
    1.c.196t.dom3:  _10 = __builtin_malloc (18446744073709551615);
    1.c.196t.dom3:  _33 = __builtin_malloc (i_51);
    1.c.196t.dom3:  _5 = __builtin_malloc (0);

    [...]

    1.c.254t.optimized:  _2 = __builtin_malloc (_1);
    1.c.254t.optimized:  _10 = __builtin_malloc (18446744073709551615);
    1.c.254t.optimized:  _33 = __builtin_malloc (i_51);
    1.c.254t.optimized:  _5 = __builtin_malloc (0);

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

end of thread, other threads:[~2023-01-13 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 21:09 [Bug tree-optimization/108377] New: Unexpected 'exceeds maximum object size' diagnostic, wrong-code? tschwinge at gcc dot gnu.org
2023-01-11 21:19 ` [Bug tree-optimization/108377] " tschwinge at gcc dot gnu.org
2023-01-11 21:23 ` pinskia at gcc dot gnu.org
2023-01-11 21:28 ` pinskia at gcc dot gnu.org
2023-01-13 13:12 ` tschwinge 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).