public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52546] New: -fstack-usage not working with __attribute__((naked))
@ 2012-03-09 20:34 marek.vasut at gmail dot com
  2012-03-09 21:49 ` [Bug c/52546] " ebotcazou at gcc dot gnu.org
  2012-03-09 22:53 ` marek.vasut at gmail dot com
  0 siblings, 2 replies; 3+ messages in thread
From: marek.vasut at gmail dot com @ 2012-03-09 20:34 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52546
           Summary: -fstack-usage not working with __attribute__((naked))
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marek.vasut@gmail.com


Dear GCC hackers,

I get the following output while compiling my code (isolated snippet follows):

spl_mem_init.c: In function 'data_abort_memdetect_handler':
spl_mem_init.c:180:1: warning: -fstack-usage not supported for this target
[enabled by default]

Culprit:
void data_abort_memdetect_handler(void) __attribute__((naked));
void data_abort_memdetect_handler(void)
{
        asm volatile("subs pc, r14, #4");
}

gcc --version
arm-linux-gnueabi-gcc (Debian 4.6.2-14) 4.6.2
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Though this is observed also with stock GCC 4.6.

Is there any way to tell the compiler how much stack does a naked function
consume (or that it consumes zero stack)? Is this a GCC bug?

Thanks in advance!


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

* [Bug c/52546] -fstack-usage not working with __attribute__((naked))
  2012-03-09 20:34 [Bug c/52546] New: -fstack-usage not working with __attribute__((naked)) marek.vasut at gmail dot com
@ 2012-03-09 21:49 ` ebotcazou at gcc dot gnu.org
  2012-03-09 22:53 ` marek.vasut at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2012-03-09 21:49 UTC (permalink / raw)
  To: gcc-bugs

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

Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-09
                 CC|                            |ebotcazou at gcc dot
                   |                            |gnu.org
     Ever Confirmed|0                           |1
           Severity|normal                      |enhancement

--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> 2012-03-09 21:48:46 UTC ---
> Is there any way to tell the compiler how much stack does a naked function
> consume (or that it consumes zero stack)? Is this a GCC bug?

It's a limitation.  We could indeed do better, but if you know how much stack
space the function uses, what's the point in asking the compiler? :-)


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

* [Bug c/52546] -fstack-usage not working with __attribute__((naked))
  2012-03-09 20:34 [Bug c/52546] New: -fstack-usage not working with __attribute__((naked)) marek.vasut at gmail dot com
  2012-03-09 21:49 ` [Bug c/52546] " ebotcazou at gcc dot gnu.org
@ 2012-03-09 22:53 ` marek.vasut at gmail dot com
  1 sibling, 0 replies; 3+ messages in thread
From: marek.vasut at gmail dot com @ 2012-03-09 22:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Vasut <marek.vasut at gmail dot com> 2012-03-09 22:53:04 UTC ---
(In reply to comment #1)
> > Is there any way to tell the compiler how much stack does a naked function
> > consume (or that it consumes zero stack)? Is this a GCC bug?
> 
> It's a limitation.  We could indeed do better, but if you know how much stack
> space the function uses, what's the point in asking the compiler? :-)

Ok, that's understandable and it's a really good function. It'd be certainly
favorable to avoid using such feature (specify how much the function uses), but
exactly for cases like this, it'd be very helpful to have. I'm no GC hacker
myself so I have no idea how much work it'd be to write such a thing and if
it'd be acceptable at all.

Thanks for your quick reply!


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

end of thread, other threads:[~2012-03-09 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 20:34 [Bug c/52546] New: -fstack-usage not working with __attribute__((naked)) marek.vasut at gmail dot com
2012-03-09 21:49 ` [Bug c/52546] " ebotcazou at gcc dot gnu.org
2012-03-09 22:53 ` marek.vasut at gmail dot com

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).