[Bug c/84229] A valid code rejected with -flto

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Feb 20 15:33:00 GMT 2018


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

--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
For reference, this is open implementation from Jessie version of glibc that
trigeers the issue
__fortify_function int                                                          
open (const char *__path, int __oflag, ...)                                     
{                                                                               
  if (__va_arg_pack_len () > 1)                                                 
    __open_too_many_args ();                                                    

  if (__builtin_constant_p (__oflag))                                           
    {                                                                           
      if (__OPEN_NEEDS_MODE (__oflag) && __va_arg_pack_len () < 1)              
        {                                                                       
          __open_missing_mode ();                                               
          return __open_2 (__path, __oflag);                                    
        }                                                                       
      return __open_alias (__path, __oflag, __va_arg_pack ());                  
    }                                                                           

  if (__va_arg_pack_len () < 1)                                                 
    return __open_2 (__path, __oflag);                                          

  return __open_alias (__path, __oflag, __va_arg_pack ());                      
}                                                                               

I am testing patch to prevent signature changes here. I suppose that those
functions are meant to be inlined and thus function signature changes are not
that important.

Still it would be nice to error on use in nonvariadic functions.


More information about the Gcc-bugs mailing list