------- Comment #1 from gdr at integrable-solutions dot net  2005-12-21 19:17 
-------
Subject: Re:   New: change semantics of const volatile variables

"drepper at redhat dot com" <[EMAIL PROTECTED]> writes:

| In math code we often have to make sure the compiler does not fold operations
| at compile time.  In glibc we use variable declared as
| 
|   static const volatile double foo = 42.0;
| 
| The problem is that gcc moves such variables into .data.  But we could
achieve
| that easily by leaving out the 'const'.  What is needed is a method to
achieve
| volatile behavior while having the variable in .rodata (and .rodata.cst8
etc).
| 
| I therefore would like to ask for a change in the compiler which preserves
the
| 'const' in the presence of 'volatile' and place the variable in read-only
| memory.

that is tricky because of the general interpretation:

       [#10] EXAMPLE 1 An object declared

               extern const volatile int real_time_clock;

       may  be  modifiable  by hardware, but cannot be assigned to,
       incremented, or decremented.

If it may be modified by hardware or other external means, it can't go
into .rodata section.

-- Gaby


-- 


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

Reply via email to