public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden
       [not found] <bug-93115-4@http.gcc.gnu.org/bugzilla/>
@ 2020-10-03  9:12 ` slyfox at gcc dot gnu.org
  2021-02-08 13:30 ` slyfox at gcc dot gnu.org
  2021-02-08 17:16 ` slyfox at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2020-10-03  9:12 UTC (permalink / raw)
  To: gcc-bugs

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

Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slyfox at gcc dot gnu.org

--- Comment #6 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Still happens with gcc-11.

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

* [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden
       [not found] <bug-93115-4@http.gcc.gnu.org/bugzilla/>
  2020-10-03  9:12 ` [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden slyfox at gcc dot gnu.org
@ 2021-02-08 13:30 ` slyfox at gcc dot gnu.org
  2021-02-08 17:16 ` slyfox at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-02-08 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Looks like original test does not trigger the bug as is (probably due to tets
fragility). Here is something shorter (but with warnings):

```c++
struct a {
  char at;
  char au;
  int d() { return av() + au - at; }
  virtual void f() {}
  virtual int av() { }
};
struct g : a {
  void f();
  char b;
  char c() { return b; }
} b;
#ifdef MAIN_FILE
g e;
void h() {
  if (b.c()) {
    e.d();
    return;
  }
}
int main() {}
#endif
#ifdef LIB_FILE
void g::f() {}
#endif
```

$ g++-11.0.0 -Wall -fPIC -O1 -fdevirtualize -fdevirtualize-speculatively
-fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden -fPIC -shared -o libbug.so
bug.cpp -DLIB_FILE
bug.cpp: In member function 'virtual int a::av()':
bug.cpp:6:22: warning: no return statement in function returning non-void
[-Wreturn-type]
    6 |   virtual int av() { }
      |                      ^

$ g++-11.0.0 -Wall -fPIC -O1 -fdevirtualize -fdevirtualize-speculatively
-fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden -o main bug.cpp -DMAIN_FILE
-L. -lbug
bug.cpp: In member function 'virtual int a::av()':
bug.cpp:6:22: warning: no return statement in function returning non-void
[-Wreturn-type]
    6 |   virtual int av() { }
      |                      ^
/usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/bin/ld:
/tmp/ccbaHYef.o: in function `h()':
bug.cpp:(.text+0x1a): undefined reference to `a::av()'
collect2: error: ld returned 1 exit status

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

* [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden
       [not found] <bug-93115-4@http.gcc.gnu.org/bugzilla/>
  2020-10-03  9:12 ` [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden slyfox at gcc dot gnu.org
  2021-02-08 13:30 ` slyfox at gcc dot gnu.org
@ 2021-02-08 17:16 ` slyfox at gcc dot gnu.org
  2 siblings, 0 replies; 3+ messages in thread
From: slyfox at gcc dot gnu.org @ 2021-02-08 17:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
Slightly better example without warnings (used `__builtin_trap();` to work
around use of uninitialized value):

```c++
struct a {
  char ac1;
  char ac2;
  int d() { return av() + ac1 + ac2; }
  virtual void f() {}
  virtual int av() { __builtin_trap(); }

  a(){}
};

struct g : a {
  virtual void f2();

  g():a(){}
};

#ifdef LIB_FILE
void g::f2() {}
#endif
#ifdef MAIN_FILE
static g b;
static char bb;
char cc() { return bb; }

void h() {
  if (cc()) {
    b.d();
    return;
  }
}
int main() {}
#endif
```

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

end of thread, other threads:[~2021-02-08 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93115-4@http.gcc.gnu.org/bugzilla/>
2020-10-03  9:12 ` [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden slyfox at gcc dot gnu.org
2021-02-08 13:30 ` slyfox at gcc dot gnu.org
2021-02-08 17:16 ` slyfox 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).