public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ipa/101941] New: Linux kernel build failure due to retaining fnsplit fragment with __attribute__((__error__))
@ 2021-08-16 22:36 dmalcolm at gcc dot gnu.org
  2021-08-16 22:36 ` [Bug ipa/101941] " dmalcolm at gcc dot gnu.org
                   ` (30 more replies)
  0 siblings, 31 replies; 32+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-08-16 22:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101941
           Summary: Linux kernel build failure due to retaining fnsplit
                    fragment with __attribute__((__error__))
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

I'm attaching a reduced reproducer for an issue seen when attempting to build a
recent linux kernel with gcc trunk (x86_64 gcc 12).

With: "-O2 -fconserve-stack", the attached fails with:

$ ~/gcc-install/bin/gcc -S -O2 -fconserve-stack aesni-intel_glue.c
In function ‘memset’,
    inlined from ‘rfc4106_set_hash_subkey.part.0’ at aesni-intel_glue.c:58:3:
aesni-intel_glue.c:30:5: error: call to ‘__write_overflow’ declared with
attribute error: detected write beyond size of object passed as 1st parame\
ter
   30 |     __write_overflow();
      |     ^~~~~~~~~~~~~~~~~~

Looking at -fdump-tree-all, I see that a "void rfc4106_set_hash_subkey.part.0
()" is created in .050t.fnsplit, containing:

void rfc4106_set_hash_subkey.part.0 ()
{
  int D.2043;
  struct crypto_aes_ctx ctx;
  int ret;
  size_t p_size;
  u8 * hash_subkey;
  const u8 * key;
  unsigned int key_len;
  int _1;

  <bb 3> [local count: 1073741824]:

  <bb 2> [local count: 1073741824]:
  __write_overflow ();
  fortify_panic (&__func__);

}

and is called by rfc4106_set_hash_subkey.

However after .104t.phiprop, the call to rfc4106_set_hash_subkey.part.0 is
optimized away, but the function fragment is retained, leading to the build
failure in "expand", where at .247t.optimized it has:

;; Function rfc4106_set_hash_subkey.part.0 (rfc4106_set_hash_subkey.part.0,
funcdef_no=3, decl_uid=2035, cgraph_uid=14, symbol_order=14)

void rfc4106_set_hash_subkey.part.0 ()                                          
{                                                                               
  <bb 2> [local count: 1073741824]:
  __write_overflow ();
  fortify_panic (&__func__);                                                    
}                                                                               

where __write_overflow is marked with __attribute__((__error__))

Reproducer on godbolt.org:
  https://godbolt.org/z/15oehqjGP

Presumably if all calls to a fn "part" are optimized away, that fn part should
also be optimized away.

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

end of thread, other threads:[~2022-01-18 10:36 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 22:36 [Bug ipa/101941] New: Linux kernel build failure due to retaining fnsplit fragment with __attribute__((__error__)) dmalcolm at gcc dot gnu.org
2021-08-16 22:36 ` [Bug ipa/101941] " dmalcolm at gcc dot gnu.org
2021-08-16 22:50 ` pinskia at gcc dot gnu.org
2021-08-16 23:02 ` [Bug ipa/101941] [12 Regression] " dmalcolm at gcc dot gnu.org
2021-08-17  7:56 ` rguenth at gcc dot gnu.org
2021-08-18 13:47 ` dmalcolm at gcc dot gnu.org
2021-09-16 23:00 ` pinskia at gcc dot gnu.org
2021-09-17  8:47 ` jakub at gcc dot gnu.org
2021-09-17  8:53 ` jakub at gcc dot gnu.org
2021-09-20  8:18 ` dac324 at yahoo dot de
2021-11-15  9:37 ` pinskia at gcc dot gnu.org
2021-11-15  9:43 ` aldyh at gcc dot gnu.org
2021-11-15 10:00 ` pinskia at gcc dot gnu.org
2021-11-15 14:38 ` jakub at gcc dot gnu.org
2021-11-16  4:24 ` pinskia at gcc dot gnu.org
2021-11-16  5:07 ` pinskia at gcc dot gnu.org
2021-11-16  5:59 ` pinskia at gcc dot gnu.org
2021-11-16  6:14 ` pinskia at gcc dot gnu.org
2021-11-16  6:24 ` pinskia at gcc dot gnu.org
2021-11-16 10:04 ` hubicka at kam dot mff.cuni.cz
2021-11-16 10:23 ` jakub at gcc dot gnu.org
2021-11-16 10:41 ` hubicka at gcc dot gnu.org
2021-11-17  1:12 ` pinskia at gcc dot gnu.org
2021-11-17  3:10 ` pinskia at gcc dot gnu.org
2021-11-17  6:27 ` pinskia at gcc dot gnu.org
2022-01-12 14:17 ` dmalcolm at gcc dot gnu.org
2022-01-13 14:23 ` marxin at gcc dot gnu.org
2022-01-13 14:24 ` marxin at gcc dot gnu.org
2022-01-13 14:29 ` pinskia at gcc dot gnu.org
2022-01-13 15:01 ` siddhesh at gcc dot gnu.org
2022-01-18 10:36 ` cvs-commit at gcc dot gnu.org
2022-01-18 10:36 ` pinskia 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).