Bug #14995 CC: ERROR File = listener.cc, Line = 187 "i" has already been declared in the c

Submitted: 16 Nov 2005 19:39 Modified: 18 Aug 2006 1:43
Reporter: Joerg Behrens Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:Mysql-5.0.15 OS:Other (IRIX64 6.5.28)
Assigned to: Hartmut Holzgraefe CPU Architecture:Any

[16 Nov 2005 19:39] Joerg Behrens
Description:
When compiling mysql-5.0.15 the following error happends.

gmake[3]: Entering directory `/raids/strip2/MIPS/mysql-5.0.15/server-tools/instance-manager'
CC -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER -I. -I. -I../.. -I/usr/nekoware/include -I../../include -I/usr/nekoware/include -I../../include  -I/usr/nekoware/include  -O3 -DDBUG_OFF -O3 -mips4  -I/usr/nekoware/include -OPT:Olimit=0:roundoff=3  -TARG:platform=IP27:proc=r10000 -LANG:exceptions=OFF -LANG:std=OFF -LANG:libc_in_namespace_std=OFF   -D_BOOL -c -o listener.o listener.cc
cc-1101 CC: ERROR File = listener.cc, Line = 174
  "i" has already been declared in the current scope.

    for (int i= 0; i < num_sockets; i++)
             ^

cc-1101 CC: ERROR File = listener.cc, Line = 187
  "i" has already been declared in the current scope.

    for (int i= 0; i < num_sockets; i++)
             ^

2 errors detected in the compilation of "listener.cc".
gmake[3]: *** [listener.o] Fehler 2
gmake[3]: Leaving directory `/raids/strip2/MIPS/mysql-5.0.15/server-tools/instance-manager'
gmake[2]: *** [all-recursive] Fehler 1
gmake[2]: Leaving directory `/raids/strip2/MIPS/mysql-5.0.15/server-tools'
gmake[1]: *** [all-recursive] Fehler 1
gmake[1]: Leaving directory `/raids/strip2/MIPS/mysql-5.0.15'

regards
Joerg Behrens

How to repeat:
Comiling the stable mysql-5.0.15 source in IRIX 6.5.28 with latest MIPS CC 7.4.3 compilier.
[16 Nov 2005 23:02] Hartmut Holzgraefe
while newer revisions of the c++ standard define that variables declared within
 
  for(...;...;...)

are local to the loop it is still not considered portable to rely on it
[16 Nov 2005 23:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32337
[14 Mar 2006 10:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3816
[14 Mar 2006 18:59] Paul DuBois
I added a note to the coding guidelines.
[22 Apr 2006 14:38] Joerg Behrens
Well, the *same* errors are in the current 5.0.20a.

cc-1101 CC: ERROR File = listener.cc, Line = 179
  "i" has already been declared in the current scope.

    for (int i= 0; i < num_sockets; i++)
             ^

cc-1548 CC: WARNING File = listener.cc, Line = 112
  The transfer of control bypasses...

            ... the initialization of variable "i" (declared at line 120).
            ... the initialization of variable "i" (declared at line 179).
      goto err;
      ^

cc-1101 CC: ERROR File = listener.cc, Line = 192
  "i" has already been declared in the current scope.

    for (int i= 0; i < num_sockets; i++)
             ^

2 errors detected in the compilation of "listener.cc".

regards
Joerg
[23 Apr 2006 1:04] Kent Boortz
I just verified that on IRIX 6.5 with MIPSpro Compilers: Version 7.41
the 5.0.20a source can be compiled if configured with

 CC=cc \
 CXX=CC \
 CFLAGS="-O3 -c99 -OPT:Olimit=0" \
 CXXFLAGS="-O3  -c99 -OPT:Olimit=0 -LANG:exceptions=OFF \
 -LANG:std=ON -LANG:libc_in_namespace_std=OFF" \
 ./configure--prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data \
 --libexecdir=/usr/local/mysql/bin --with-extra-charsets=complex \
 --enable-thread-safe-client --enable-local-infile  --disable-shared \
 --with-zlib-dir=bundled --with-big-tables --with-readline \
 --with-archive-storage-engine --with-innodb

Now, the resulting binary doesn't work but that is another story,
bug#13711.
[24 Apr 2006 6:31] Valeriy Kravchuk
Joerg,

Please, try to compile 5.0.20a with options suggested in Kent's last comment. If you'll have no error messages like before, we can close this bug report, I think.
[25 Apr 2006 11:52] Joerg Behrens
Ok.. it compiles. 
But i cant see any different flag expect the issue that i have used some exports foo=bar first.

regards
Joerg
[5 Aug 2006 11:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10068

ChangeSet@1.2242, 2006-08-05 13:41:22+02:00, hartmut@mysql.com +1 -0
    relying on loop counter variables being local to the loop body if 
    declared in the 'for' statement is not portable, some compilers
    still don't implement this ANSI C++ specification (Bug #14995)
[17 Aug 2006 16:23] Chad MILLER
Available in 5.0.25 and soon in 5.1.12-beta.
[18 Aug 2006 1:43] Paul DuBois
Compilation fix. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.046 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.