This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/32099] New: a constant value is said to be not constant
- From: "andrei dot kouznetsov at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 May 2007 18:15:24 -0000
- Subject: [Bug c/32099] New: a constant value is said to be not constant
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
when I'm trying to compile the program
============================
#include <math.h>
static double s = sin(0.0);
int main(){
return 0;
}
============================
with gcc t.c, the compiler produces the warnings
t.c:3: warning: initializer element is not constant
t.c:3: warning: (near initialization for ?s?)
t.c:3: warning: ?s? defined but not used
I'm worried about the first warning, since sin(0) is constant
gcc -v generates:
=======================================
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 (Ubuntu 4.1.2-0ubuntu4)
--
Summary: a constant value is said to be not constant
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: andrei dot kouznetsov at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32099