Bug 25448 - [4.0/4.1/4.2/4.3 Regression] Unfounded warnings from the AVR backend
[4.0/4.1/4.2/4.3 Regression] Unfounded warnings from the AVR backend
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
4.1.0
: P5 normal
: 4.1.3
Assigned To: Not yet assigned to anyone
: diagnostic
Depends on:
Blocks: 34299
  Show dependency treegraph
 
Reported: 2005-12-16 17:11 UTC by berndtrog
Modified: 2009-02-27 16:23 UTC (History)
2 users (show)

See Also:
Host:
Target: avr
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-12-25 01:20:03


Attachments
proposed patch (408 bytes, patch)
2005-12-16 17:13 UTC, berndtrog
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description berndtrog 2005-12-16 17:11:32 UTC
Hello,

when compiling this code:

   procedure My_int;
   pragma Machine_Attribute (My_int, "signal");
   pragma Export (C, My_int, "__vector_1");
   procedure My_int is begin null; end;

with avr-gcc-4.x I get this warning:

demo_ada.adb:9: warning: `demo_ada__my_int' appears to be a misspelled
signal handler

I do not get this warning with gcc-3.4.x.

IMO, this is caused by the misspelled-signames patch
from Theodore A. Roth:

avr.c:
[...]
{
 const char *func_name = IDENTIFIER_POINTER (DECL_NAME (*node));
 const char *attr = IDENTIFIER_POINTER (name);

 /* If the function has the 'signal' or 'interrupt' attribute, test to
    make sure that the name of the function is "__vector_NN" so as to
    catch when the user misspells the interrupt vector name.  */

 if (strncmp (attr, "interrupt", strlen ("interrupt")) == 0)
   {
   if (strncmp (func_name, "__vector", strlen ("__vector")) != 0)
     {
      warning (0, "%qs appears to be a misspelled interrupt handler",
               func_name);
[...]

Ted's patch is a bit too C specific, because it assumes that the source
code function name is equal the symbol name. 
(__vector_1 = __vector_1)

In Ada, the source code function name (demo_ada__my_int) for interrupts is
translated to__vector_xx with the "Pragma Export (..)" statement.
Its not possible to define "__vector_1" as a source code function name.
Comment 1 berndtrog 2005-12-16 17:13:38 UTC
Created attachment 10516 [details]
proposed patch

patch to replace DECL_NAME by DECL_ASSEMBLER_NAME
Comment 2 Andrew Pinski 2005-12-25 01:20:03 UTC
Confirmed, it also can be reproduced with normal C and using asm on the function to change what the assembly name is.
Comment 3 Gabriel Dos Reis 2007-02-03 16:09:18 UTC
Won't fix in GCC-4.0.x.  Adjusting milestone.
Comment 4 aesok 2007-04-05 16:43:50 UTC
Subject: Bug 25448

Author: aesok
Date: Thu Apr  5 16:43:35 2007
New Revision: 123519

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123519
Log:
	PR target/25448
	* config/avr/avr.c (avr_handle_fndecl_attribute): Use the 
	DECL_ASSEMBLER_NAME, not the DECL_NAME.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/avr/avr.c

Comment 5 aesok 2007-04-05 16:50:43 UTC
Subject: Bug 25448

Author: aesok
Date: Thu Apr  5 16:50:27 2007
New Revision: 123520

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123520
Log:
	PR target/25448
	* config/avr/avr.c (avr_handle_fndecl_attribute): Use the 
	DECL_ASSEMBLER_NAME, not the DECL_NAME.

Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/avr/avr.c

Comment 6 aesok 2007-04-05 16:56:58 UTC
Subject: Bug 25448

Author: aesok
Date: Thu Apr  5 16:56:43 2007
New Revision: 123521

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=123521
Log:
	PR target/25448
	* config/avr/avr.c (avr_handle_fndecl_attribute): Use the 
	DECL_ASSEMBLER_NAME, not the DECL_NAME.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/config/avr/avr.c

Comment 7 aesok 2007-04-05 16:59:52 UTC
Fixsed in 4.1.3, 4.2 and 4.3.