public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions
@ 2003-08-03  1:24 pgonzalez at bluel dot com
  2003-08-03  1:55 ` [Bug c++/11775] " pgonzalez at bluel dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-03  1:24 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775

           Summary: "Control reaches end" warning issued for
                    __attribute__((naked)) functions
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pgonzalez at bluel dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-arm-elf

If I run "g++ test.cpp -c -Wall" on the attached source code,
the following warning is reported:

test.cpp: In function `int test()':
test.cpp:5: warning: control reaches end of non-void function

This does not make sense, and there is no way to selectively
disable the warning.  GCC 3.3.1 has the same behavior.
___________

__attribute__((naked))
int test() {
  asm("mov r0, #1");  // custom assembly
}


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
@ 2003-08-03  1:55 ` pgonzalez at bluel dot com
  2003-08-03 14:58 ` [Bug target/11775] " pinskia at physics dot uc dot edu
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-03  1:55 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775



------- Additional Comments From pgonzalez at bluel dot com  2003-08-03 01:55 -------
I'm also having the same problem with this warning:

test.cpp(111) : warning: no return statement in function returning 
   non-void


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
  2003-08-03  1:55 ` [Bug c++/11775] " pgonzalez at bluel dot com
@ 2003-08-03 14:58 ` pinskia at physics dot uc dot edu
  2003-08-09  5:39 ` pgonzalez at bluel dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-03 14:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
  2003-08-03  1:55 ` [Bug c++/11775] " pgonzalez at bluel dot com
  2003-08-03 14:58 ` [Bug target/11775] " pinskia at physics dot uc dot edu
@ 2003-08-09  5:39 ` pgonzalez at bluel dot com
  2003-08-09  5:42 ` pgonzalez at bluel dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-09  5:39 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775



------- Additional Comments From pgonzalez at bluel dot com  2003-08-09 05:39 -------
Created an attachment (id=4583)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=4583&action=view)
Test.cpp

Compile with this command: "gcc -c -O2 Test.cpp -marm -save-temps"

The output file Test.s should contain three "smull" instructions and six
"smlal" instructions.  However, with GCC 3.3 and later the generated code is
incorrect, e.g. there is only one "smull" instruction and two "smlal"
instructions.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (3 preceding siblings ...)
  2003-08-09  5:42 ` pgonzalez at bluel dot com
@ 2003-08-09  5:42 ` pgonzalez at bluel dot com
  2003-08-23  2:51 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-09  5:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


pgonzalez at bluel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #4583|Test.cpp                    |DISREGARD
        description|                            |


------- Additional Comments From pgonzalez at bluel dot com  2003-08-09 05:42 -------
(From update of attachment 4583)
Please delete this attachment!	I accidentally attached it to the wrong bug. 
:-)

------- Additional Comments From pgonzalez at bluel dot com  2003-08-09 05:42 -------
(From update of attachment 4583)
Please delete this attachment!	I accidentally attached it to the wrong bug. 
:-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (2 preceding siblings ...)
  2003-08-09  5:39 ` pgonzalez at bluel dot com
@ 2003-08-09  5:42 ` pgonzalez at bluel dot com
  2003-08-09  5:42 ` pgonzalez at bluel dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-09  5:42 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


pgonzalez at bluel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #4583|Test.cpp                    |DISREGARD
        description|                            |


------- Additional Comments From pgonzalez at bluel dot com  2003-08-09 05:42 -------
(From update of attachment 4583)
Please delete this attachment!	I accidentally attached it to the wrong bug. 
:-)

------- Additional Comments From pgonzalez at bluel dot com  2003-08-09 05:42 -------
(From update of attachment 4583)
Please delete this attachment!	I accidentally attached it to the wrong bug. 
:-)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (4 preceding siblings ...)
  2003-08-09  5:42 ` pgonzalez at bluel dot com
@ 2003-08-23  2:51 ` pinskia at gcc dot gnu dot org
  2003-08-25 14:16 ` dhazeghi at yahoo dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-23  2:51 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
   Target Milestone|3.4                         |---


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (5 preceding siblings ...)
  2003-08-23  2:51 ` pinskia at gcc dot gnu dot org
@ 2003-08-25 14:16 ` dhazeghi at yahoo dot com
  2003-08-25 18:58 ` pgonzalez at bluel dot com
  2003-09-11 16:28 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-25 14:16 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


dhazeghi at yahoo dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
  GCC build triplet|i686-pc-linux-gnu           |
   GCC host triplet|i686-pc-linux-gnu           |


------- Additional Comments From dhazeghi at yahoo dot com  2003-08-25 14:16 -------
I'm not certain I agree with you that this is a bug. To silence that warning, wouldn't using 
__attribute__((noreturn) make sense? __attribute__((naked)) only deals with codegen, namely the 
programmer must provide prologue and epilogue, so I fail to see why it should change the warning 
you're having.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (6 preceding siblings ...)
  2003-08-25 14:16 ` dhazeghi at yahoo dot com
@ 2003-08-25 18:58 ` pgonzalez at bluel dot com
  2003-09-11 16:28 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pgonzalez at bluel dot com @ 2003-08-25 18:58 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775



------- Additional Comments From pgonzalez at bluel dot com  2003-08-25 18:58 -------
> To silence that warning, wouldn't using __attribute__((noreturn) 
> make sense? 

The example I gave above returns the value "1" by moving it into
the ARM register r0.  Maybe I don't fully understand the intent
of the "naked" feature.  Since the prologue/epilogue code involves
setting up the stack frame (which requires knowledge of how
the compiler is allocating local variables etc), it seems that
the most common usage would be cases where the entire function 
body is written in inline assembler.  I am using it this way,
to allow hand-coding of functions generated by C++ macros (which
would be difficult to code directly in assembler).

If there are valid cases where "naked" functions would rely on
the compiler-generated code to return values (which it sounds
like you are saying), then I agree that the warning should not 
be disabled by "naked".  However, there should be some way to 
disable this warning for an individual function.  Maybe this 
can be merged with bug 9049.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/11775] "Control reaches end" warning issued for __attribute__((naked)) functions
  2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
                   ` (7 preceding siblings ...)
  2003-08-25 18:58 ` pgonzalez at bluel dot com
@ 2003-09-11 16:28 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-09-11 16:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11775


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |DUPLICATE


------- Additional Comments From pinskia at gcc dot gnu dot org  2003-09-11 16:27 -------
The person is asking for disabling some warnings so marking as a dup of bug 9049.

*** This bug has been marked as a duplicate of 9049 ***


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-09-11 16:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-03  1:24 [Bug c++/11775] New: "Control reaches end" warning issued for __attribute__((naked)) functions pgonzalez at bluel dot com
2003-08-03  1:55 ` [Bug c++/11775] " pgonzalez at bluel dot com
2003-08-03 14:58 ` [Bug target/11775] " pinskia at physics dot uc dot edu
2003-08-09  5:39 ` pgonzalez at bluel dot com
2003-08-09  5:42 ` pgonzalez at bluel dot com
2003-08-09  5:42 ` pgonzalez at bluel dot com
2003-08-23  2:51 ` pinskia at gcc dot gnu dot org
2003-08-25 14:16 ` dhazeghi at yahoo dot com
2003-08-25 18:58 ` pgonzalez at bluel dot com
2003-09-11 16:28 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).