This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug lto/85248] [6/7/8 Regression] Miscompilation when using error function that returns


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the issue is:

extern void __error_noreturn (int __status, int __errnum, const char *__format,
...) __asm__ ("" "error")
  __attribute__ ((__noreturn__, __format__ (__printf__, 3, 4)));

and

extern __inline __attribute__ ((__always_inline__)) __attribute__
((__gnu_inline__)) void
error (int __status, int __errnum, const char *__format, ...)
{
  if (__builtin_constant_p (__status) && __status != 0)
    __error_noreturn (__status, __errnum, __format, __builtin_va_arg_pack ());
  else
    __error_alias (__status, __errnum, __format, __builtin_va_arg_pack ());
}


and LTO ending up with

main (int argc)
{
  int D.4004;
  int _1;
  int _4;

  <bb 2> [100.00%]:
  _4 = 0;
  _5 = _4;
  _1 = _5;
  if (_1 != 0)
    goto <bb 3>; [0.04%]
  else
    goto <bb 4>; [99.96%]

  <bb 3> [0.04%]:
  __error_noreturn (1, 0, "usage\n");

  <bb 4> [99.96%]:
  __error_noreturn (0, 1, "");

seemingly with bogus expansion and/or alias resolving.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]