public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/103662] New: TBAA problem in Fortran FE triggering in gfortran.dg/unlimited_polymorphic_3.f03
@ 2021-12-11 19:25 hubicka at gcc dot gnu.org
  2021-12-12  8:32 ` [Bug fortran/103662] " hubicka at gcc dot gnu.org
                   ` (26 more replies)
  0 siblings, 27 replies; 28+ messages in thread
From: hubicka at gcc dot gnu.org @ 2021-12-11 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103662
           Summary: TBAA problem in Fortran FE triggering in
                    gfortran.dg/unlimited_polymorphic_3.f03
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hubicka at gcc dot gnu.org
  Target Milestone: ---

In this testcase we have:

void foo (struct __class__STAR_p & restrict tgt)
{
  struct s * ptr1;
  integer(kind=4) _1;

  <bb 2> [local count: 1073741824]:
  ptr1_4 = *tgt_3(D)._data;
  _1 = *ptr1_4.k;
  if (_1 != 42)
    goto <bb 3>; [0.04%]
  else
    goto <bb 4>; [99.96%]

  <bb 3> [local count: 429496]:
  _gfortran_stop_numeric (2, 0);

  <bb 4> [local count: 1073312329]:
  return;

}

The load ptr1_4 = *tgt_3(D)._data has alias sets:
 - Analyzing load: *tgt_3(D)._data
   - Recording base_set=9 ref_set=5  Parm 0 param offset:0 offset:0 size:64
max_size:64
 - Analyzing load: *ptr1_4.k
   - Recording base_set=11 ref_set=2 

Now the value is set in main:

void MAIN__ ()
{
  integer(kind=8) y$_len;
  struct __vtype__STAR * {ref-all} y$_vptr;
  void * y$_data;
  struct __class__STAR_p z;
  struct __class__STAR_p y;
  struct sq x;
  static struct __vtype_main_Sq __vtab_main_Sq = {._hash=85658372, ._size=4,
._extends=0B, ._def_init=&__def_init_main_Sq, ._copy=__copy_main_Sq,
._final=0B, ._deallocate=0B};
  static struct sq __def_init_main_Sq;

  <bb 2> [local count: 1073741824]:
  x.i = 42;
  z._vptr = &__vtab_main_Sq;
  z._len = 0;
  z._data = &x;
  foo (&z);
  bar ();
  x ={v} {CLOBBER};
  y ={v} {CLOBBER};
  z ={v} {CLOBBER};
  return;

}

here however the z._data store is:
ipa-modref: call stmt foo (&z);                                                 
ipa-modref: call to foo/0 does not use ref: z._data alias sets: 4->5            
  Deleted dead store: z._data = &x;                                             

So it has base alias set 4 which is not considered aliasing with alias set 9. 
With mainline version of modref we do not perform the optimization because we
are paranoid about _gfortran_stop_numeric (2, 0); possibly accessing something.
If this is replaced by code that does not perform call we get wrong code with
-Os.

So __class__STAR_p is produced twice while it should not be.

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

end of thread, other threads:[~2022-04-27  9:37 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-11 19:25 [Bug fortran/103662] New: TBAA problem in Fortran FE triggering in gfortran.dg/unlimited_polymorphic_3.f03 hubicka at gcc dot gnu.org
2021-12-12  8:32 ` [Bug fortran/103662] " hubicka at gcc dot gnu.org
2021-12-14 15:51 ` cvs-commit at gcc dot gnu.org
2021-12-14 18:27 ` anlauf at gcc dot gnu.org
2021-12-14 18:34 ` hubicka at kam dot mff.cuni.cz
2021-12-14 21:53 ` seurer at gcc dot gnu.org
2021-12-15  9:08 ` clyon at gcc dot gnu.org
2022-01-04  9:32 ` rguenth at gcc dot gnu.org
2022-01-04  9:33 ` [Bug fortran/103662] [12 Regression] " rguenth at gcc dot gnu.org
2022-01-17 12:48 ` rguenth at gcc dot gnu.org
2022-01-17 17:36 ` hubicka at kam dot mff.cuni.cz
2022-01-18 14:09 ` rguenth at gcc dot gnu.org
2022-03-22 11:50 ` jakub at gcc dot gnu.org
2022-03-24 14:48 ` jakub at gcc dot gnu.org
2022-04-18 18:21 ` mikael at gcc dot gnu.org
2022-04-18 18:23 ` mikael at gcc dot gnu.org
2022-04-19 13:46 ` jakub at gcc dot gnu.org
2022-04-19 14:07 ` jakub at gcc dot gnu.org
2022-04-19 15:27 ` rguenth at gcc dot gnu.org
2022-04-19 16:12 ` mikael at gcc dot gnu.org
2022-04-19 16:51 ` jakub at gcc dot gnu.org
2022-04-20 10:16 ` hubicka at kam dot mff.cuni.cz
2022-04-24 13:32 ` cvs-commit at gcc dot gnu.org
2022-04-25  7:50 ` rguenth at gcc dot gnu.org
2022-04-25 11:32 ` cvs-commit at gcc dot gnu.org
2022-04-26  7:18 ` cvs-commit at gcc dot gnu.org
2022-04-26 14:57 ` hubicka at kam dot mff.cuni.cz
2022-04-27  9:36 ` cvs-commit 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).