From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28726 invoked by alias); 21 Dec 2005 19:17:53 -0000 Received: (qmail 28713 invoked by alias); 21 Dec 2005 19:17:51 -0000 Date: Wed, 21 Dec 2005 19:17:00 -0000 Message-ID: <20051221191751.28712.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/25521] change semantics of const volatile variables In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gdr at integrable-solutions dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-12/txt/msg02259.txt.bz2 List-Id: ------- 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" 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