comp.lang.ada
 help / color / mirror / Atom feed
* Any way to turn of constant merging in GCC 2.8.1?
@ 2006-02-10  0:13 Anonymous Coward
  2006-02-10  3:51 ` Keith Thompson
  2006-02-18  3:01 ` Craig Carey
  0 siblings, 2 replies; 7+ messages in thread
From: Anonymous Coward @ 2006-02-10  0:13 UTC (permalink / raw)


I need to be able to use the -fno-merge-constants option in GCC 2.8.1,
which does not seem to be an option in this version.  Are there any
workarounds?  

I may have to write a script to turn all constants into variables at
prior to compilation by removing all "constant" tokens.  It's pretty
ugly, but seems to be the only remedy.



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

* Re: Any way to turn of constant merging in GCC 2.8.1?
  2006-02-10  0:13 Any way to turn of constant merging in GCC 2.8.1? Anonymous Coward
@ 2006-02-10  3:51 ` Keith Thompson
  2006-02-10  6:13   ` Anonymous Coward
  2006-02-18  3:01 ` Craig Carey
  1 sibling, 1 reply; 7+ messages in thread
From: Keith Thompson @ 2006-02-10  3:51 UTC (permalink / raw)


Anonymous Coward <anonymous@coward.org> writes:
> I need to be able to use the -fno-merge-constants option in GCC 2.8.1,
> which does not seem to be an option in this version.  Are there any
> workarounds?  
>
> I may have to write a script to turn all constants into variables at
> prior to compilation by removing all "constant" tokens.  It's pretty
> ugly, but seems to be the only remedy.

Just out of curiosity, why do you need to do this?  Why do you care
about constants being merged, as long as the program behaves
correctly?  (I'm not implying that you don't have a legitimate reason,
I'm just wondering what it is.)

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.



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

* Re: Any way to turn of constant merging in GCC 2.8.1?
  2006-02-10  3:51 ` Keith Thompson
@ 2006-02-10  6:13   ` Anonymous Coward
  0 siblings, 0 replies; 7+ messages in thread
From: Anonymous Coward @ 2006-02-10  6:13 UTC (permalink / raw)


In article <ln4q37swff.fsf@nuthaus.mib.org>, Keith Thompson wrote:
> Anonymous Coward <anonymous@coward.org> writes:
> 
> Just out of curiosity, why do you need to do this?  Why do you care
> about constants being merged, as long as the program behaves
> correctly?  (I'm not implying that you don't have a legitimate
> reason, I'm just wondering what it is.)

For testing purposes, I need to be able to read constants, as well as
change them.  Merged constants are invisible to gdb.



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

* Re: Any way to turn of constant merging in GCC 2.8.1?
  2006-02-10  0:13 Any way to turn of constant merging in GCC 2.8.1? Anonymous Coward
  2006-02-10  3:51 ` Keith Thompson
@ 2006-02-18  3:01 ` Craig Carey
  2006-02-18 10:37   ` Craig Carey
  1 sibling, 1 reply; 7+ messages in thread
From: Craig Carey @ 2006-02-18  3:01 UTC (permalink / raw)


On Fri, 10 Feb 2006 00:13 GMT, Mr Coward <anonymous@coward.org> wrote:

>I need to be able to use the -fno-merge-constants option in GCC 2.8.1,
...



In GNAT 3.15p Ada the "aliased constant" feature can be used.
(Ref. AARM 3.3.1, http://www.ada-auth.org/ ).

(The GCC 2.8.1 gcc.exe executable of GNAT 3.15p accepts that command
line option.)


| Craig Carey



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

* Re: Any way to turn of constant merging in GCC 2.8.1?
  2006-02-18  3:01 ` Craig Carey
@ 2006-02-18 10:37   ` Craig Carey
  2006-02-18 17:10     ` GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?) Anonymous Coward
  0 siblings, 1 reply; 7+ messages in thread
From: Craig Carey @ 2006-02-18 10:37 UTC (permalink / raw)


On Sat, 18 Feb 2006 16:01:03 +1300, Craig Carey wrote:
>On Fri, 10 Feb 2006 00:13 GMT, Mr Coward <anonymous@coward.org> wrote:
>
>>I need to be able to use the -fno-merge-constants option in GCC 2.8.1,
...
>(The GCC 2.8.1 gcc.exe executable of GNAT 3.15p accepts that command

Correction: gcc.exe of GNAT 3.15p does not accept the
-fno-merge-constants option. (I made a mistake reconfiguring
a Slickedit text editor):

   cc1.exe: Invalid option `-fno-merge-constants'

MinGW 3.3.1 is faster and better, and it's gcc.exe accepts
 "-fno-merge-constants".

 "-fmerge-constants   Attempt to merge identical constants (string
   constants and floating point constants) across compilation units."
  [is the default]

---

PS. There is a PDF help for GCC 3.4.4, here:

http://www.intelligentedu.com/blogs/Free_Computer_Books.php?p=9

| Red Hat Enterprise Linux Using the GNU Compiler Collection (GCC)
| PDF (1328 KB) |  HTML Tarball (236 KB):

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/pdf/rhel-gcc-en.pdf

(Also some PDF manuals for: cpp, gdb, and as.)

There are *.chm manuals here: http://htmlhelp.berlios.de/books/chm.php

---

It seems that Team-Ada is dying, ie. increasingly messages announce
meetings for people to visit (maybe IBM would pay for air-fares if a
deal could be figured out, eg. opposing Mr Robert Dewar in official
voting sessions):

   http://listserv.acm.org/archives/team-ada.html

My old page on other lists: http://www.ijs.co.nz/ada_95.htm

---

Tigris allows SVN hosting of Ada projects under the 'personal'
 category. Also they allow websites to be uploaded. Mr Richard allowed
 his website at www.adaworld.com to have a draft at my SVN site.
 I might upload the AdaCore Academic Initiative website adacore.com
 or something. I don't know why Mr Dewar likes pale blue so much. It
 never has been an academic colour.

I have : http://terratope.tigris.org/


>| Craig Carey






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

* GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?)
  2006-02-18 10:37   ` Craig Carey
@ 2006-02-18 17:10     ` Anonymous Coward
  2006-02-20 21:55       ` Randy Brukardt
  0 siblings, 1 reply; 7+ messages in thread
From: Anonymous Coward @ 2006-02-18 17:10 UTC (permalink / raw)


In article <l2udv19u69kcshrp88jasi68b11ddh01l0@4ax.com>, 
Craig Carey wrote:
> 
>  "-fmerge-constants   Attempt to merge identical constants (string
>    constants and floating point constants) across compilation units."
>   [is the default]

I may have misunderstood what merging constants does.  If it's only
merging identical constants, then inhibiting it won't help me.

My problem is that the debugger will not break on a definition for a
constant, and in some cases it will not allow me to override a
constant value.  It appears that the compiler may be doing some kind
of optimization, though I'm using the -O0 switch.

Are you saying (in your first response) that aliased constants won't
have this problem?



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

* Re: GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?)
  2006-02-18 17:10     ` GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?) Anonymous Coward
@ 2006-02-20 21:55       ` Randy Brukardt
  0 siblings, 0 replies; 7+ messages in thread
From: Randy Brukardt @ 2006-02-20 21:55 UTC (permalink / raw)


"Anonymous Coward" <anonymous@coward.org> wrote in message
news:lyIJf.284$gh4.197@trnddc06...
...
> My problem is that the debugger will not break on a definition for a
> constant, and in some cases it will not allow me to override a
> constant value.  It appears that the compiler may be doing some kind
> of optimization, though I'm using the -O0 switch.

This isn't an optimization; it's essentially required by the Ada definition.
That is, "static expressions" have to be evaluated at compile-time. Once
that's done, there is no reason to store the constant in memory; the value
is used wherever it is referenced. A compiler that wastes memory for static
values would be pretty silly; I doubt that there are any that do that.
(Janus/Ada is pretty conservative about our code generation with the
optimizer off, but we don't use memory that we don't need.)

That probably means that there is no chance to break on it, because it has
no presence in memory. I can't speak for GDB, but certainly Janus/Ada and
our debugger can't break on a constant's definition, because nothing
whatsoever is generated for it. It would be like trying to break on "2".

Marking the constant as "aliased" requires that it has a machine address, so
the compiler will generate a variable for it. Then you probably can break on
it.

                           Randy.





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

end of thread, other threads:[~2006-02-20 21:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-10  0:13 Any way to turn of constant merging in GCC 2.8.1? Anonymous Coward
2006-02-10  3:51 ` Keith Thompson
2006-02-10  6:13   ` Anonymous Coward
2006-02-18  3:01 ` Craig Carey
2006-02-18 10:37   ` Craig Carey
2006-02-18 17:10     ` GDB won't break on constants (was: Any way to turn of constant merging in GCC 2.8.1?) Anonymous Coward
2006-02-20 21:55       ` Randy Brukardt

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