public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments
@ 2023-03-29 11:14 siddhesh at gcc dot gnu.org
  2023-03-30 22:04 ` [Bug tree-optimization/109334] " muecker at gwdg dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: siddhesh at gcc dot gnu.org @ 2023-03-29 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109334
           Summary: tree-object-size: Improve size computation in
                    arguments
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siddhesh at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, marxin at gcc dot gnu.org,
                    msebor at gcc dot gnu.org, muecker at gwdg dot de,
                    siddhesh at gcc dot gnu.org
        Depends on: 104970
  Target Milestone: ---

The fix for bug 104970 is too restrictive, size computation should also work
for VLA bounds and also cases where it could work without attributes in simple
cases, e.g.

size_t
__attribute__ ((noinline))
test_parmsz_internal3 (size_t sz1, size_t sz2, double obj[sz1][sz2])
{
  return __builtin_dynamic_object_size (obj, 0);
}

or

__attribute__ ((noinline, access (read_only, 2, 1)))
int foo(int n, int buf[n])
{
    buf[n] = 1;
    return __builtin_dynamic_object_size(buf, 0);
}

int main() {
    int n = 10;
    int buf[n];
    return foo(n, buf);
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104970
[Bug 104970] [12 Regression] ICE in execute_todo, at passes.cc:2133 since
r12-6480-gea19c8f33a3a8d2b

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

* [Bug tree-optimization/109334] tree-object-size: Improve size computation in arguments
  2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
@ 2023-03-30 22:04 ` muecker at gwdg dot de
  2023-03-31 12:27 ` siddhesh at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: muecker at gwdg dot de @ 2023-03-30 22:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Uecker <muecker at gwdg dot de> ---
Created attachment 54796
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54796&action=edit
partial fix


Simply removing the condition based on internal_p would make it work for the
most important cases as in the attached patch.  The check for constant sizes
already
prevents the original ICE.

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

* [Bug tree-optimization/109334] tree-object-size: Improve size computation in arguments
  2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
  2023-03-30 22:04 ` [Bug tree-optimization/109334] " muecker at gwdg dot de
@ 2023-03-31 12:27 ` siddhesh at gcc dot gnu.org
  2023-10-29  6:48 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: siddhesh at gcc dot gnu.org @ 2023-03-31 12:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
That seems OK; I had added that to be conservative since I really only intended
to add support for the access attribute back then and not the implicit
attributes.  Could you please post that on the ML and have it reviewed? 
Thanks!

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

* [Bug tree-optimization/109334] tree-object-size: Improve size computation in arguments
  2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
  2023-03-30 22:04 ` [Bug tree-optimization/109334] " muecker at gwdg dot de
  2023-03-31 12:27 ` siddhesh at gcc dot gnu.org
@ 2023-10-29  6:48 ` cvs-commit at gcc dot gnu.org
  2023-10-29  7:29 ` sjames at gcc dot gnu.org
  2024-05-07  7:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-29  6:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Uecker <uecker@gcc.gnu.org>:

https://gcc.gnu.org/g:d96757842a13cad3500b74a352ab34d27a8be622

commit r14-4993-gd96757842a13cad3500b74a352ab34d27a8be622
Author: Martin Uecker <uecker@tugraz.at>
Date:   Wed Oct 25 23:24:34 2023 +0200

    tree-optimization/109334: Improve computation for access attribute

    The fix for PR104970 restricted size computations to the case
    where the access attribute was specified explicitly (no VLA).
    It also restricted it to void pointers or elements with constant
    sizes.  The second restriction is enough to fix the original bug.
    Revert the first change to again allow size computations for VLA
    parameters and for VLA parameters together with an explicit access
    attribute.

    gcc/ChangeLog:

            PR tree-optimization/109334
            * tree-object-size.cc (parm_object_size): Allow size
            computation for implicit access attributes.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/109334
            * gcc.dg/builtin-dynamic-object-size-0.c
            (test_parmsz_simple3): Supported again.
            (test_parmsz_external4): New test.
            * gcc.dg/builtin-dynamic-object-size-20.c: New test.
            * gcc.dg/pr104970.c: New test.

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

* [Bug tree-optimization/109334] tree-object-size: Improve size computation in arguments
  2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-10-29  6:48 ` cvs-commit at gcc dot gnu.org
@ 2023-10-29  7:29 ` sjames at gcc dot gnu.org
  2024-05-07  7:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: sjames at gcc dot gnu.org @ 2023-10-29  7:29 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sjames at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Target Milestone|---                         |14.0
             Status|UNCONFIRMED                 |NEW
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104970
   Last reconfirmed|                            |2023-10-29

--- Comment #4 from Sam James <sjames at gcc dot gnu.org> ---
Fixed for 14 then?

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

* [Bug tree-optimization/109334] tree-object-size: Improve size computation in arguments
  2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-10-29  7:29 ` sjames at gcc dot gnu.org
@ 2024-05-07  7:40 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-07  7:40 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|14.0                        |14.2

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 14.1 is being released, retargeting bugs to GCC 14.2.

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

end of thread, other threads:[~2024-05-07  7:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 11:14 [Bug tree-optimization/109334] New: tree-object-size: Improve size computation in arguments siddhesh at gcc dot gnu.org
2023-03-30 22:04 ` [Bug tree-optimization/109334] " muecker at gwdg dot de
2023-03-31 12:27 ` siddhesh at gcc dot gnu.org
2023-10-29  6:48 ` cvs-commit at gcc dot gnu.org
2023-10-29  7:29 ` sjames at gcc dot gnu.org
2024-05-07  7:40 ` 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).