comp.lang.ada
 help / color / mirror / Atom feed
* GNAT/GCC and -fstack-check
@ 2010-10-25 20:15 Yannick Duchêne (Hibou57)
  2010-10-26  5:11 ` Yannick Duchêne (Hibou57)
  2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
  0 siblings, 2 replies; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-25 20:15 UTC (permalink / raw)


Hi happy people out there,

I would like to know if some ones had the same I get.

First a few words about the context. I wanted to get ride of having two  
compilers, GNAT from AdaCore and GNAT from MinGW, to keep only one, which  
I choose to be MinGW for multiple reasons. When I wanted to build some  
applications which was built before with GNAT from AdaCore with now the  
GNAT from MinGW, I get a surprising behavior.

I was using -fstack-check in the GPR file. At compile time, I get these  
king of messages :

    xxxxx.adb: In function 'XXX.YYY'
    xxxxx.adb:1:22: warning: frame size too large for reliable stack  
checking
    xxxxx.adb:1:22: warning: try reducing the number of local variables


Where XXX.YYY is actually not a function but a package (do not know why  
the message says it is a function). Moreover, there was not so much local  
variables… just a few.

None of the compiled applications could launch and were all crashing right  
at stat-up. After some time (I check the package raising these warnings  
was the ones whose initialization was crashing) I decided to remove the  
-fstack-check option from the GPR file. There were then no more warnings  
and compiled applications could run properly.

I wonder if this is GCC related or GNAT related. The MinGW is the last one  
(decided to update it in the while), it seems to use GCC 4.5 and GNAT  
2009. I suppose it is based on GNAT 2009, as “gnat make -v” does not know  
about the “-gnat12” option.

Any body experienced something similar with GNAT and -fstack-check ? Or is  
are there some reasons to suppose this is more GCC related than GNAT  
related ?



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

* Re: GNAT/GCC and -fstack-check
  2010-10-25 20:15 GNAT/GCC and -fstack-check Yannick Duchêne (Hibou57)
@ 2010-10-26  5:11 ` Yannick Duchêne (Hibou57)
  2010-10-26  5:23   ` Yannick Duchêne (Hibou57)
  2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
  1 sibling, 1 reply; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26  5:11 UTC (permalink / raw)


Le Mon, 25 Oct 2010 22:15:21 +0200, Yannick Duchêne (Hibou57)  
<yannick_duchene@yahoo.fr> a écrit:

Three years ago, Niklas Holsti seems to to have raised the same question :

http://www.rhinocerus.net/forum/lang-ada/116262-gnat-fstack-check-does-work.html
He said :

    [In “GNAT and -fstack-check, does it work?”]
    I have been using those options for a while, but I was recently hit
    by a bug in which stack overflow made the program abort with
    Segmentation Violation (signal 11 = SIGSEGV) instead of the
    expected Storage_Error exception.

Which is exactly what I get too. I get a signal, not an exception,  
otherwise I wouldn't get a Windows crash-box.

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26  5:11 ` Yannick Duchêne (Hibou57)
@ 2010-10-26  5:23   ` Yannick Duchêne (Hibou57)
  2010-10-26  8:04     ` Ludovic Brenta
  0 siblings, 1 reply; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26  5:23 UTC (permalink / raw)


Le Tue, 26 Oct 2010 07:11:51 +0200, Yannick Duchêne (Hibou57)  
<yannick_duchene@yahoo.fr> a écrit:

Seven years ago, there was bug report for the same :
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10127
(not the same Niklas was talking about, this one is even older).
It was marked as solved… I feel it was either not really or else it is  
back. By the way, I am surprised the Ada environment does not catch this  
signal to turn it into an exception. I would understand if this was a  
compiler bug, but what I now see as a compiler bug, is that the program  
does not catch the signal and let the program crash.

I will either investigate more to understand what is going wrong with the  
stack with that package, or else will simply drop the use of -fstack-check  
(as I am not sure this make the program crash because there is indeed a  
real stack overflow somewhere).

Any opinions and thoughts on that topic appreciated


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26  5:23   ` Yannick Duchêne (Hibou57)
@ 2010-10-26  8:04     ` Ludovic Brenta
  2010-10-26  8:16       ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2010-10-26  8:04 UTC (permalink / raw)


This GCC back-end problem is old and has been reported multiple times
with several variants:

http://gcc.gnu.org/PR10127
http://gcc.gnu.org/PR13182 (still open)
http://gcc.gnu.org/PR13757 (duplicate of PR10127)
http://gcc.gnu.org/PR20548
http://gcc.gnu.org/PR39306 (duplicate of PR10127)

I first learned of this problem thanks to PR20548 and consequently
removed -fstack-check from all Ada packages in Debian.

PR10127 and PR20548 were both fixed in November 2009 in the trunk,
therefore this fix should be in GCC >= 4.5.0 (per
http://gcc.gnu.org/develop.html#timeline).

-- 
Ludovic Brenta.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26  8:04     ` Ludovic Brenta
@ 2010-10-26  8:16       ` Yannick Duchêne (Hibou57)
  2010-10-26 15:11         ` Ludovic Brenta
  0 siblings, 1 reply; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26  8:16 UTC (permalink / raw)


Le Tue, 26 Oct 2010 10:04:53 +0200, Ludovic Brenta  
<ludovic@ludovic-brenta.org> a écrit:

> I first learned of this problem thanks to PR20548 and consequently
> removed -fstack-check from all Ada packages in Debian.
If you did this, I suppose this means I should do so.

> PR10127 and PR20548 were both fixed in November 2009 in the trunk,
> therefore this fix should be in GCC >= 4.5.0 (per
> http://gcc.gnu.org/develop.html#timeline).
But the GCC I now use is :

    gcc.exe (GCC) 4.5.0
    Copyright (C) 2010 Free Software Foundation, Inc.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26  8:16       ` Yannick Duchêne (Hibou57)
@ 2010-10-26 15:11         ` Ludovic Brenta
  2010-10-26 16:33           ` Georg Bauhaus
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2010-10-26 15:11 UTC (permalink / raw)


Yannick Duchêne wrote on comp.lang.ada:
>> PR10127 and PR20548 were both fixed in November 2009 in the trunk,
>> therefore this fix should be in GCC >= 4.5.0 (per
>> http://gcc.gnu.org/develop.html#timeline).
>
> But the GCC I now use is :
>
>     gcc.exe (GCC) 4.5.0
>     Copyright (C) 2010 Free Software Foundation, Inc.

Ah, there is also

http://gcc.gnu.org/PR43013

Read the comments from Eric Botcazou...

--
Ludovic Brenta.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-25 20:15 GNAT/GCC and -fstack-check Yannick Duchêne (Hibou57)
  2010-10-26  5:11 ` Yannick Duchêne (Hibou57)
@ 2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
  2010-10-26 15:38   ` Yannick Duchêne (Hibou57)
  2010-10-26 18:19   ` Ludovic Brenta
  1 sibling, 2 replies; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26 15:38 UTC (permalink / raw)


Le Mon, 25 Oct 2010 22:15:21 +0200, Yannick Duchêne (Hibou57)  
<yannick_duchene@yahoo.fr> a écrit:

By the way, the GNAT documentation about stack analysis and handling seems  
a bit outdated. It talks about an “-fstack-usage” option, which does not  
seems to be recognized (gnatmake complains “invalid switch:  
-fstack-usage”). Some web-talks about this option strictly concerning GCC  
says it is not neither supported by GCC anymore.

I am talking about this option, because I attempted to use it to check if  
something is really wrong with the stack.

Note that I did not get the error from “-fstack-check” with the GCC 3.x of  
GNAT 2010.


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
@ 2010-10-26 15:38   ` Yannick Duchêne (Hibou57)
  2010-10-26 18:19   ` Ludovic Brenta
  1 sibling, 0 replies; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26 15:38 UTC (permalink / raw)


Le Tue, 26 Oct 2010 17:38:12 +0200, Yannick Duchêne (Hibou57)  
<yannick_duchene@yahoo.fr> a écrit:
> By the way, the GNAT documentation about stack analysis and handling
Sorry, forget the link :
http://www.adacore.com/wp-content/files/auto_update/gnat-unw-docs/html/gnat_ugn_24.html

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26 15:11         ` Ludovic Brenta
@ 2010-10-26 16:33           ` Georg Bauhaus
  0 siblings, 0 replies; 13+ messages in thread
From: Georg Bauhaus @ 2010-10-26 16:33 UTC (permalink / raw)


On 26.10.10 17:11, Ludovic Brenta wrote:

> http://gcc.gnu.org/PR43013
> 
> Read the comments from Eric Botcazou...

Hm.. Maybe this means that with GNAT 4.6, we can again hope
to use larger stack allocated objects again?



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
  2010-10-26 15:38   ` Yannick Duchêne (Hibou57)
@ 2010-10-26 18:19   ` Ludovic Brenta
  2010-10-26 18:55     ` Yannick Duchêne (Hibou57)
  1 sibling, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2010-10-26 18:19 UTC (permalink / raw)


Yannick Duchêne writes on comp.lang.ada
> Le Mon, 25 Oct 2010 22:15:21 +0200, Yannick Duchêne (Hibou57)
> <yannick_duchene@yahoo.fr> a écrit:
>
> By the way, the GNAT documentation about stack analysis and handling
> seems a bit outdated. It talks about an “-fstack-usage” option, which
> does not  seems to be recognized (gnatmake complains “invalid switch:
> -fstack-usage”). Some web-talks about this option strictly concerning
> GCC  says it is not neither supported by GCC anymore.

I suggest you report this as a documentation bug.

> I am talking about this option, because I attempted to use it to check
> if something is really wrong with the stack.
> 
> Note that I did not get the error from “-fstack-check” with the GCC
> 3.x of GNAT 2010.

That would be 4.3.x, of course.  And the error from "-fstack-check"
depends on a complex set of conditions.

-- 
Ludovic Brenta.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26 18:19   ` Ludovic Brenta
@ 2010-10-26 18:55     ` Yannick Duchêne (Hibou57)
  2010-10-27  7:35       ` Ludovic Brenta
  0 siblings, 1 reply; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-26 18:55 UTC (permalink / raw)


Le Tue, 26 Oct 2010 20:19:11 +0200, Ludovic Brenta  
<ludovic@ludovic-brenta.org> a écrit:
>> By the way, the GNAT documentation about stack analysis and handling
>> seems a bit outdated. It talks about an “-fstack-usage” option, which
>> does not  seems to be recognized (gnatmake complains “invalid switch:
>> -fstack-usage”). Some web-talks about this option strictly concerning
>> GCC  says it is not neither supported by GCC anymore.
>
> I suggest you report this as a documentation bug.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46189
(with CC to you)

> That would be 4.3.x, of course.  And the error from "-fstack-check"
> depends on a complex set of conditions.
You're Right


-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-26 18:55     ` Yannick Duchêne (Hibou57)
@ 2010-10-27  7:35       ` Ludovic Brenta
  2010-10-27 14:58         ` Yannick Duchêne (Hibou57)
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Brenta @ 2010-10-27  7:35 UTC (permalink / raw)


Yannick Duchêne wrote on comp.lang.ada:
> Ludovic Brenta a écrit:
>> By the way, the GNAT documentation about stack analysis and handling
>>> seems a bit outdated. It talks about an “-fstack-usage” option, which
>>> does not  seems to be recognized (gnatmake complains “invalid switch:
>>> -fstack-usage”). Some web-talks about this option strictly concerning
>>> GCC  says it is not neither supported by GCC anymore.
>
>> I suggest you report this as a documentation bug.
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46189
> (with CC to you)

[The bug was rejected as the option -fstack-usage is actually new in
GNAT Pro and GCC 4.6, not old]

I apologize for making this recommendation so quickly.  I didn't
realize you were comparing apples (the latest GNAT Pro documentation
from the latest nightly build at AdaCore's web site) and oranges (the
latest stable release of GCC).  Today's GNAT Pro is roughly equivalent
to the trunk of GCC (the future GCC 4.6), but since Stage 1 ends
today, GNAT Pro is going to start moving ahead from GCC again.

The documentation for GCC is here:
http://gcc.gnu.org/onlinedocs/

This includes stable releases (the latest is 4.5.1) and, at the bottom
of the page, nightly builds (the future 4.6.0).  I see the latter
includes information on -fstack-usage.

--
Ludovic Brenta.



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

* Re: GNAT/GCC and -fstack-check
  2010-10-27  7:35       ` Ludovic Brenta
@ 2010-10-27 14:58         ` Yannick Duchêne (Hibou57)
  0 siblings, 0 replies; 13+ messages in thread
From: Yannick Duchêne (Hibou57) @ 2010-10-27 14:58 UTC (permalink / raw)


Le Wed, 27 Oct 2010 09:35:46 +0200, Ludovic Brenta  
<ludovic@ludovic-brenta.org> a écrit:
> [The bug was rejected as the option -fstack-usage is actually new in
> GNAT Pro and GCC 4.6, not old]
>
> I apologize for making this recommendation so quickly.  I didn't
> realize you were comparing apples
Don't bother, this gonna be to remember my first submission to the GCC bug  
list (lol) (I do regularly submit bug reports for some things, but the  
first time for GCC). And I was wrong too, because I did not care enough.

-- 
Si les chats miaulent et font autant de vocalises bizarres, c’est pas pour  
les chiens.



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

end of thread, other threads:[~2010-10-27 14:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25 20:15 GNAT/GCC and -fstack-check Yannick Duchêne (Hibou57)
2010-10-26  5:11 ` Yannick Duchêne (Hibou57)
2010-10-26  5:23   ` Yannick Duchêne (Hibou57)
2010-10-26  8:04     ` Ludovic Brenta
2010-10-26  8:16       ` Yannick Duchêne (Hibou57)
2010-10-26 15:11         ` Ludovic Brenta
2010-10-26 16:33           ` Georg Bauhaus
2010-10-26 15:38 ` Yannick Duchêne (Hibou57)
2010-10-26 15:38   ` Yannick Duchêne (Hibou57)
2010-10-26 18:19   ` Ludovic Brenta
2010-10-26 18:55     ` Yannick Duchêne (Hibou57)
2010-10-27  7:35       ` Ludovic Brenta
2010-10-27 14:58         ` Yannick Duchêne (Hibou57)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox