public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/104303] [12 regression] gnatmake is miscompiled by IPA/modref
Date: Thu, 31 Mar 2022 12:51:00 +0000	[thread overview]
Message-ID: <bug-104303-4-YobP8MlO2a@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104303-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The store

D.5010.P_BOUNDS = &D.5011;

is

 <component_ref 0x7ffff4e951e0
    type <pointer_type 0x7ffff653b150
        type <record_type 0x7ffff653bf18 string___XUB type_4 DI
            size <integer_cst 0x7ffff6517c00 constant 64>
            unit-size <integer_cst 0x7ffff6517c18 constant 8>
            align:32 warn_if_not_align:0 symtab:0 alias-set 9 canonical-type
0x7ffff653bf18 fields <field_decl 0x7ffff6541260 LB0> Ada size <integer_cst
0x7ffff6517c00 64>
            pointer_to_this <pointer_type 0x7ffff653b150> chain <type_decl
0x7ffff6541428 string___XUB>>
        public unsigned DI size <integer_cst 0x7ffff6517c00 64> unit-size
<integer_cst 0x7ffff6517c18 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set 4 canonical-type
0x7ffff653b150>

    arg:0 <var_decl 0x7ffff4e9a090 D.5010
        type <record_type 0x7ffff653b348 string sizes-gimplified visited type_0
TI
            size <integer_cst 0x7ffff6517c48 constant 128>
            unit-size <integer_cst 0x7ffff6517c60 constant 16>
            align:64 warn_if_not_align:0 symtab:0 alias-set 2 canonical-type
0x7ffff653b348 fields <field_decl 0x7ffff6538ab0 P_ARRAY> context
<translation_unit_decl 0x7ffff6522168 concat5_pkg1.adb> unconstrained array
<unconstrained_array_type 0x7ffff653b540 string>
            pointer_to_this <pointer_type 0x7ffff4e9b498> chain <type_decl
0x7ffff6538c78 string>>
        used ignored TI concat5_pkg1.adb:15:5 size <integer_cst 0x7ffff6517c48
128> unit-size <integer_cst 0x7ffff6517c60 16>
        align:128 warn_if_not_align:0 context <function_decl 0x7ffff4e83900
concat5_pkg1__scan>
        chain <var_decl 0x7ffff4e9a120 D.5011 type <record_type 0x7ffff653bf18
string___XUB>
            addressable used ignored DI concat5_pkg1.adb:15:5 size <integer_cst
0x7ffff6517c00 64> unit-size <integer_cst 0x7ffff6517c18 8>
            align:32 warn_if_not_align:0 context <function_decl 0x7ffff4e83900
concat5_pkg1__scan> chain <var_decl 0x7ffff4e9a240 saved_stack.10>>>
    arg:1 <field_decl 0x7ffff6538b48 P_BOUNDS type <pointer_type
0x7ffff653b150>
        visited unsigned DI <built-in>:0:0 size <integer_cst 0x7ffff6517c00 64>
unit-size <integer_cst 0x7ffff6517c18 8>
        align:64 warn_if_not_align:0 offset_align 128
        offset <integer_cst 0x7ffff6517c30 constant 0> bit-offset <integer_cst
0x7ffff6517c00 64> context <record_type 0x7ffff653b348 string>>>

and the issue is that somehow the summary for

concat5_pkg1.make_failed (D.5010);

only has an base/ref/access node for MODREF_GLOBAL_MEMORY_PARM and
nothing else.  In .modref2 this function is just

void concat5_pkg1.make_failed (struct  s)
{
  struct string___XUB * s$P_BOUNDS;

  <bb 2> [local count: 1073741824]:
  concat5_pkg2.compare (s);
  return;

but we do

modref analyzing 'Concat5_Pkg1.Make_Failed/0' (ipa=0)
Past summary:
  loads:
    Every base
  stores:
    Every base
  Side effects
  Nondeterministic
  Global memory read
  Global memory written
 - Analyzing load: s
   - Read-only or local, ignoring.
 - Analyzing call:concat5_pkg2.compare (s);
 - Function availability <= AVAIL_INTERPOSABLE.
 - modref done with result: tracked.
  loads:
      Base 0: alias set 0
        Ref 0: alias set 0
          access: Base in global memory
  stores:
      Base 0: alias set 0
        Ref 0: alias set 0
          access: Base in global memory
  Side effects
  Nondeterministic
  Global memory read
  Global memory written

so it seems we fail to consider by-value escaping parameters.  Something
like the following, but it does not reproduce with that, so there must
be sth special with the Ada testcase.

struct X { int i; };

void foo (struct X);

static void __attribute__((noinline))
bar (struct X x)
{
  foo (x);
}

void baz ()
{
  struct X x;
  x.i = 1;
  bar (x);
}

Btw, if we disable modref2 the testcase works - so somehow dropping that we
load/store all bases wrecks things.

Honza?

  parent reply	other threads:[~2022-03-31 12:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 10:09 [Bug ipa/104303] New: [12 regression] gnatmake is miscompiled by IPA/modef ebotcazou at gcc dot gnu.org
2022-01-31 10:12 ` [Bug ipa/104303] [12 regression] gnatmake is miscompiled by IPA/modref pinskia at gcc dot gnu.org
2022-01-31 10:21 ` hubicka at gcc dot gnu.org
2022-02-01  8:18 ` rguenth at gcc dot gnu.org
2022-03-22 14:52 ` jakub at gcc dot gnu.org
2022-03-31 12:51 ` rguenth at gcc dot gnu.org [this message]
2022-03-31 13:12 ` hubicka at gcc dot gnu.org
2022-04-03 23:49 ` hubicka at gcc dot gnu.org
2022-04-05 21:46 ` hubicka at gcc dot gnu.org
2022-04-07 11:47 ` rguenth at gcc dot gnu.org
2022-04-07 11:57 ` rguenth at gcc dot gnu.org
2022-04-07 12:12 ` rguenth at gcc dot gnu.org
2022-04-07 13:01 ` hubicka at kam dot mff.cuni.cz
2022-04-07 13:03 ` cvs-commit at gcc dot gnu.org
2022-04-07 13:04 ` rguenth at gcc dot gnu.org
2022-04-07 14:16 ` ebotcazou at gcc dot gnu.org
2022-04-12 15:05 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-104303-4-YobP8MlO2a@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).