public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Why is there now a difference between "{static const char a[]={...}" and "{const char a[]={...}"?
@ 2018-10-30  2:15 John Carter
  2018-11-02 11:12 ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: John Carter @ 2018-10-30  2:15 UTC (permalink / raw)
  To: GCC help

https://gcc.godbolt.org/z/6c4QLO

Something changed between gcc 4.1 and 4.4

-- 
John Carter
Phone : (64)(3) 358 6639
Tait Electronics
PO Box 1645 Christchurch
New Zealand

-- 
This Communication is Confidential. We only send and receive email on the

basis of the terms set out at www.taitradio.com/email_disclaimer 
<http://www.taitradio.com/email_disclaimer>

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

* Re: Why is there now a difference between "{static const char a[]={...}" and "{const char a[]={...}"?
  2018-10-30  2:15 Why is there now a difference between "{static const char a[]={...}" and "{const char a[]={...}"? John Carter
@ 2018-11-02 11:12 ` Jonathan Wakely
  2018-11-02 11:13   ` Jonathan Wakely
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2018-11-02 11:12 UTC (permalink / raw)
  To: John Carter; +Cc: gcc-help

On Tue, 30 Oct 2018 at 02:16, John Carter wrote:
>
> https://gcc.godbolt.org/z/6c4QLO
>
> Something changed between gcc 4.1 and 4.4

I think this changed with https://gcc.gnu.org/r143570 to fix
https://gcc.gnu.org/PR38615

See https://gcc.gnu.org/ml/gcc/2008-11/msg00201.html and
https://gcc.gnu.org/ml/gcc/2008-11/msg00202.html for a more complete
explanation of why the 4.1 behaviour is non-conforming and had to be
fixed.

If you use -fmerge-all-constants you get the old behaviour back, but
as noted in the manual that option makes the program non-confirming.
If your program doesn't rely on stack variables having distinct
addresses in recursive calls, you can probably use that option safely.

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

* Re: Why is there now a difference between "{static const char a[]={...}" and "{const char a[]={...}"?
  2018-11-02 11:12 ` Jonathan Wakely
@ 2018-11-02 11:13   ` Jonathan Wakely
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2018-11-02 11:13 UTC (permalink / raw)
  To: John Carter; +Cc: gcc-help

On Fri, 2 Nov 2018 at 11:11, Jonathan Wakely wrote:
>
> On Tue, 30 Oct 2018 at 02:16, John Carter wrote:
> >
> > https://gcc.godbolt.org/z/6c4QLO
> >
> > Something changed between gcc 4.1 and 4.4
>
> I think this changed with https://gcc.gnu.org/r143570 to fix
> https://gcc.gnu.org/PR38615
>
> See https://gcc.gnu.org/ml/gcc/2008-11/msg00201.html and
> https://gcc.gnu.org/ml/gcc/2008-11/msg00202.html for a more complete
> explanation of why the 4.1 behaviour is non-conforming and had to be
> fixed.
>
> If you use -fmerge-all-constants you get the old behaviour back, but
> as noted in the manual that option makes the program non-confirming.

s/non-confirming/non-conforming/

> If your program doesn't rely on stack variables having distinct
> addresses in recursive calls, you can probably use that option safely.

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

end of thread, other threads:[~2018-11-02 11:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30  2:15 Why is there now a difference between "{static const char a[]={...}" and "{const char a[]={...}"? John Carter
2018-11-02 11:12 ` Jonathan Wakely
2018-11-02 11:13   ` Jonathan Wakely

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