public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable"
@ 2023-09-16 21:53 gb2985 at gmail dot com
  2023-09-16 22:14 ` [Bug c/111437] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gb2985 at gmail dot com @ 2023-09-16 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111437
           Summary: Some always inline functions are incorrectly warn of
                    as "might not be inlinable"
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gb2985 at gmail dot com
  Target Milestone: ---

Couldn't find a similar thread so my apologies if there actually was. For
starters a link to the code that made me cotton on to the issue:

https://gitlab.com/awsdert/dragonbuilder/-/blob/419c686fd59c0a40145154ef3d43b8d8b75aa29d/include/paw/pawidb.h#L34

In short it amounts to a simple LOAD, DIV, STORE set of instructions once
compiled which is undoubtedly inline-able in all situations. I had marked the
function as always inline but when gcc got to it it decided that no, those
measly few instructions are somehow not inlinable. The issue also occurs for
wrapped calls such as pawcv_gettop() calling the template generated
_pawcv_gettop(), the former existing for intellisense purposes while the latta
being what does the actual work.

I seriously doubt my system or any other details are relevant here but for what
I need to provide I'll add below (only remember one at time of posting, will
edit in rest if I can):

OS: Manjaro x64 XFCE (4.18)

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

* [Bug c/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
@ 2023-09-16 22:14 ` pinskia at gcc dot gnu.org
  2023-09-17  6:19 ` [Bug ipa/111437] " gb2985 at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-16 22:14 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-09-16
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach the preprocessed source where the warning is and the exact
command line you are using to invoke gcc?

I suspect the issue is that the function can be overridden due to use of -fPIC
or something smilar to that.

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

* [Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
  2023-09-16 22:14 ` [Bug c/111437] " pinskia at gcc dot gnu.org
@ 2023-09-17  6:19 ` gb2985 at gmail dot com
  2023-09-17  6:22 ` gb2985 at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gb2985 at gmail dot com @ 2023-09-17  6:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from zxuiji <gb2985 at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Can you attach the preprocessed source where the warning is and the exact
> command line you are using to invoke gcc?
> 
> I suspect the issue is that the function can be overridden due to use of
> -fPIC or something smilar to that.

Bugzilla wouldn't let me upload it, too big apparently, did it to my google
drive instead:
https://drive.google.com/file/d/16NiT5eWvj_B7QTz5E4zlST6sDCS67HWp/view?usp=sharing

Found the function at line 12375, still the division I expected, would've been
shocked had it been otherwise given it's just division of a allocation size by
an element size

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

* [Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
  2023-09-16 22:14 ` [Bug c/111437] " pinskia at gcc dot gnu.org
  2023-09-17  6:19 ` [Bug ipa/111437] " gb2985 at gmail dot com
@ 2023-09-17  6:22 ` gb2985 at gmail dot com
  2023-09-17  6:37 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: gb2985 at gmail dot com @ 2023-09-17  6:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from zxuiji <gb2985 at gmail dot com> ---
(In reply to zxuiji from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Can you attach the preprocessed source where the warning is and the exact
> > command line you are using to invoke gcc?
> > 
> > I suspect the issue is that the function can be overridden due to use of
> > -fPIC or something smilar to that.
> 
> Bugzilla wouldn't let me upload it, too big apparently, did it to my google
> drive instead:
> https://drive.google.com/file/d/16NiT5eWvj_B7QTz5E4zlST6sDCS67HWp/
> view?usp=sharing
> 
> Found the function at line 12375, still the division I expected, would've
> been shocked had it been otherwise given it's just division of a allocation
> size by an element size

Whoops, mistyped the line, 12735 sorry

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

* [Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
                   ` (2 preceding siblings ...)
  2023-09-17  6:22 ` gb2985 at gmail dot com
@ 2023-09-17  6:37 ` pinskia at gcc dot gnu.org
  2023-09-17  6:47 ` gb2985 at gmail dot com
  2023-09-17  8:03 ` schwab@linux-m68k.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-17  6:37 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
One definition has:
__attribute__((hot)) __attribute__((always_inline)) pawd pawmsg_SIGKILL( pawexe
pid )
 { return pawtrigger( 
# 127 "/mnt/CODE/gitlab/dragonbuilder/include/paw/pawint/../pawmsg.h" 3 4
                     ((void *)0)
# 127 "/mnt/CODE/gitlab/dragonbuilder/include/paw/pawint/../pawmsg.h"
                         , PAWMSGID_KILL_NOW, PAWMSG_CLSID_APP, 0, pid ); }

Yes without inline the always_inline might be not be inlinable ...

The preprocessed source is full of issues; redefinitions:
/mnt/CODE/gitlab/dragonbuilder/src/libpaw/pawaio.c:50:28: error: redefinition
of ‘pawabspath_putroot’
In file included from /mnt/CODE/gitlab/dragonbuilder/src/libpaw/libpaw.h:19,
                 from /mnt/CODE/gitlab/dragonbuilder/src/libpaw/pawaio.c:1:
/mnt/CODE/gitlab/dragonbuilder/include/paw/pawaio.h:554:28: note: previous
definition of ‘pawabspath_putroot’ with type ‘pawjd(pawmbcd *, pawmbctxt, 
pawmbctxt)’ {aka ‘long int(pawmbcd *, pawmbc_txt,  pawmbc_txt)’}


etc.

But the pattern for the "might not be inlinable" is all the same as what I
mentioned first. There is only always_inline without an inline ...

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

* [Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
                   ` (3 preceding siblings ...)
  2023-09-17  6:37 ` pinskia at gcc dot gnu.org
@ 2023-09-17  6:47 ` gb2985 at gmail dot com
  2023-09-17  8:03 ` schwab@linux-m68k.org
  5 siblings, 0 replies; 7+ messages in thread
From: gb2985 at gmail dot com @ 2023-09-17  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

zxuiji <gb2985 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #5 from zxuiji <gb2985 at gmail dot com> ---
(In reply to Andrew Pinski from comment #4)
> One definition has:
> __attribute__((hot)) __attribute__((always_inline)) pawd pawmsg_SIGKILL(
> pawexe pid )
>  { return pawtrigger( 
> # 127 "/mnt/CODE/gitlab/dragonbuilder/include/paw/pawint/../pawmsg.h" 3 4
>                      ((void *)0)
> # 127 "/mnt/CODE/gitlab/dragonbuilder/include/paw/pawint/../pawmsg.h"
>                          , PAWMSGID_KILL_NOW, PAWMSG_CLSID_APP, 0, pid ); }
> 
> Yes without inline the always_inline might be not be inlinable ...
> 
> The preprocessed source is full of issues; redefinitions:
> /mnt/CODE/gitlab/dragonbuilder/src/libpaw/pawaio.c:50:28: error:
> redefinition of ‘pawabspath_putroot’
> In file included from /mnt/CODE/gitlab/dragonbuilder/src/libpaw/libpaw.h:19,
>                  from /mnt/CODE/gitlab/dragonbuilder/src/libpaw/pawaio.c:1:
> /mnt/CODE/gitlab/dragonbuilder/include/paw/pawaio.h:554:28: note: previous
> definition of ‘pawabspath_putroot’ with type ‘pawjd(pawmbcd *, pawmbctxt, 
> pawmbctxt)’ {aka ‘long int(pawmbcd *, pawmbc_txt,  pawmbc_txt)’}
> 
> 
> etc.
> 
> But the pattern for the "might not be inlinable" is all the same as what I
> mentioned first. There is only always_inline without an inline ...

You mean I should add __inline to the definition of PAWANT_QCK so it follows
the always_inline attribute? Well that's easy enough however that does beg the
question, why is inline not implicit with the always_inline attribute? That
aside, yeah I'm aware there are issues with the code itself, in the middle of a
redesign and using the compiler to identify where the surface level issues are,
I'll get on the runtime ones after I finish putting together the library and
the unit tests thereafter.

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

* [Bug ipa/111437] Some always inline functions are incorrectly warn of as "might not be inlinable"
  2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
                   ` (4 preceding siblings ...)
  2023-09-17  6:47 ` gb2985 at gmail dot com
@ 2023-09-17  8:03 ` schwab@linux-m68k.org
  5 siblings, 0 replies; 7+ messages in thread
From: schwab@linux-m68k.org @ 2023-09-17  8:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andreas Schwab <schwab@linux-m68k.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

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

end of thread, other threads:[~2023-09-17  8:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-16 21:53 [Bug c/111437] New: Some always inline functions are incorrectly warn of as "might not be inlinable" gb2985 at gmail dot com
2023-09-16 22:14 ` [Bug c/111437] " pinskia at gcc dot gnu.org
2023-09-17  6:19 ` [Bug ipa/111437] " gb2985 at gmail dot com
2023-09-17  6:22 ` gb2985 at gmail dot com
2023-09-17  6:37 ` pinskia at gcc dot gnu.org
2023-09-17  6:47 ` gb2985 at gmail dot com
2023-09-17  8:03 ` schwab@linux-m68k.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).