public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/102061] New: .constprop gets exposed in warning message
@ 2021-08-25 10:35 pinskia at gcc dot gnu.org
  2021-08-25 15:42 ` [Bug ipa/102061] " msebor at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-25 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102061
           Summary: .constprop gets exposed in warning message
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Take:

static inline void
foo (char *p)
{
  __builtin___memcpy_chk (p, "abc", 3, __builtin_object_size (p, 0));
}
static void
bar (char *p) __attribute__((noinline));
static void
bar (char *p)
{
  foo (p);
}
void f(char*) __attribute__((noipa));
char buf[2];
void
baz (void) __attribute__((noinline));
void
baz (void)
{
  bar (buf);
  f(buf);
}

void f(char*)
{}

int main(void)
{
    baz();
}

---- CUT ---
Compile the C program with "-O2 -Wall", we get:
In function 'foo',
    inlined from 'bar.constprop' at <source>:12:3:
<source>:5:3: warning: '__builtin___memcpy_chk' forming offset 2 is out of the
bounds [0, 2] of object 'buf' with type 'char[2]' [-Warray-bounds]
    5 |   __builtin___memcpy_chk (p, "abc", 3, __builtin_object_size (p, 0));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<source>: In function 'bar.constprop':
<source>:15:6: note: 'buf' declared here
   15 | char buf[2];
      |      ^~~

See how bar.constprop is exposed. That is an internal details.
Note compiling it with the C++ front-end we get:
    inlined from 'void bar(char*)' at <source>:12:7:


And then compiling with -flto again we get the bar.constprop.

But really we should add another note saying where the clone was created from.

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

* [Bug ipa/102061] .constprop gets exposed in warning message
  2021-08-25 10:35 [Bug ipa/102061] New: .constprop gets exposed in warning message pinskia at gcc dot gnu.org
@ 2021-08-25 15:42 ` msebor at gcc dot gnu.org
  2021-08-26  8:26 ` rguenth at gcc dot gnu.org
  2024-06-23 23:00 ` sjames at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-25 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

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

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Can you show what you have in mind?  It's easy to to strip the .constprop
suffix but I'm not sure I understand what you mean by "where the clone was
created from."

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

* [Bug ipa/102061] .constprop gets exposed in warning message
  2021-08-25 10:35 [Bug ipa/102061] New: .constprop gets exposed in warning message pinskia at gcc dot gnu.org
  2021-08-25 15:42 ` [Bug ipa/102061] " msebor at gcc dot gnu.org
@ 2021-08-26  8:26 ` rguenth at gcc dot gnu.org
  2024-06-23 23:00 ` sjames at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-08-26  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I suppose he means to follow the DECL_ABSTRACT_ORIGIN links to the origin.

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

* [Bug ipa/102061] .constprop gets exposed in warning message
  2021-08-25 10:35 [Bug ipa/102061] New: .constprop gets exposed in warning message pinskia at gcc dot gnu.org
  2021-08-25 15:42 ` [Bug ipa/102061] " msebor at gcc dot gnu.org
  2021-08-26  8:26 ` rguenth at gcc dot gnu.org
@ 2024-06-23 23:00 ` sjames at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: sjames at gcc dot gnu.org @ 2024-06-23 23:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2024-06-23
             Status|UNCONFIRMED                 |NEW

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

end of thread, other threads:[~2024-06-23 23:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 10:35 [Bug ipa/102061] New: .constprop gets exposed in warning message pinskia at gcc dot gnu.org
2021-08-25 15:42 ` [Bug ipa/102061] " msebor at gcc dot gnu.org
2021-08-26  8:26 ` rguenth at gcc dot gnu.org
2024-06-23 23:00 ` sjames 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).