[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2018-02-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Martin Liška  changed:

   What|Removed |Added

 Status|ASSIGNED|NEW
   Assignee|marxin at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org

--- Comment #8 from Martin Liška  ---
I've noticed that C++ FE can handle the problem #1:

./xg++ -B. ~/Programming/testcases/pr82323.c
/home/marxin/Programming/testcases/pr82323.c:2:1: error: ‘int foo()’ defined
both normally and as ‘ifunc’ attribute
 foo (void) { return 0; }
 ^~~

I tried to look at the and I'm leaving this PR to somebody more skilled with
FE.

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-10-11 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

--- Comment #7 from Martin Sebor  ---
(In reply to Bernd Edlinger from comment #6)

Sounds reasonable.  I put the following example together to illustrate an
incompatible alias declaration that should be diagnosed but isn't.

  char* f (void) __attribute__ ((alias ("g")));   // missing -Wattribute-alias

  int g (s)
char *s;
  {
return __builtin_strlen (s);
  }

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-10-11 Thread bernd.edlinger at hotmail dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

--- Comment #6 from Bernd Edlinger  ---
I wonder why this condition on the warning is symmetrical:

   (!FUNC_OR_METHOD_TYPE_P (t2)
|| (prototype_p (t1)
&& prototype_p (t2)
&& !types_compatible_p (t1, t2

I mean if you have this example

void f() __attribute__((alias("g")));
int g(int a)
{
  return a;
}

only f can be w/o prototype, but g has to use the correct argument list;
thus the term "prototype_p (t2)" should be removed from the condition.

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-10-11 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Martin Sebor  changed:

   What|Removed |Added

 CC||bernd.edlinger at hotmail dot 
de

--- Comment #5 from Martin Sebor  ---
*** Bug 82512 has been marked as a duplicate of this bug. ***

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-09-28 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Eric Gallager  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-09-26 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Martin Liška  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |marxin at gcc dot 
gnu.org

--- Comment #4 from Martin Liška  ---
Good, I'm taking that for stage4.

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-09-26 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

--- Comment #3 from Martin Sebor  ---
Martin, if you have free cycles please go ahead.

I think other attributes might suffer from the same problem (alias and
weakref).  It doesn't look to me like it can be reliably detected in the
attribute handler (because it doesn't necessarily know whether it's dealing
with a definition or a declaration) so it might need to be done either in or
analogously to diagnose_mismatched_attributes in c-family/c-warn.c.

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-09-26 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška  ---
If nobody is interested, I can take a look in stage4. Martin do you want to
take the PR?

[Bug c/82323] circular ifunc attribute on a function definition silently accepted

2017-09-25 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82323

Eric Gallager  changed:

   What|Removed |Added

   Keywords||diagnostic
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-09-25
 CC||egallager at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Eric Gallager  ---
Confirmed that gcc silently accepts the example. I think it'd be okay to just
issue a warning from -Wattributes or something though, instead of rejecting it
completely.