Hi Jeff,

   PR 68913 notes that the test gcc.dg/lto/pr61886_0.c test fails on
   targets whose C library does not provide a __fread_chk function.

   Since the purpose of the test is to show that GCC will correctly
   discard the invocation of __fread_chk_warn, we do not need to actually
   link against a real __fread_chk function.  A dummy will do.

?  Isn'the purpose of this test to verify the function alias resolution
code?

I think that it is, but that the test does this by requiring that gcc only generates code that calls __fread_chk. Ie it does not generate any code that calls __fread_chk_warn. If gcc did generate code that calls __fread_chk_warn then that function's warning attribute would be triggered and we would get the warning message associated with it - and the test would fail.

Since the test only links, it does not execute, there is no need to have working versions of __fread_chk and __fread_chk_warn available. All that is necessary is that a symbol called __fread_chk is available at link time. (A symbol called __fread_chk_warn is not needed as referencing this symbol triggers a warning, which causes the test to fail). So providing a weak definition of __fread_chk should be sufficient for those runtimes which do not provide their own definition.

At least that is my theory...

Cheers
  Nick






Reply via email to