Bug 12207 - Internal compiler error in size_binop, at fold-const.c:2014
Summary: Internal compiler error in size_binop, at fold-const.c:2014
Status: RESOLVED DUPLICATE of bug 16409
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.2
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code, monitored
Depends on: 10089
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-08 13:41 UTC by Andy Krassowski
Modified: 2004-10-30 21:11 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: tree-ssa
Known to fail: 3.3.4 3.4.0 4.0.0
Last reconfirmed: 2004-01-05 06:22:28


Attachments
.i file without non-constant value in array definition (3.87 KB, text/plain)
2003-10-02 19:15 UTC, Denis Rouleau
Details
Problems when compiling with win98 (615 bytes, text/plain)
2004-01-29 16:10 UTC, Hans
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy Krassowski 2003-09-08 13:41:24 UTC
Version info:
 gcc -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2/specs
Configured with: ../configure --with-as=/usr/ccs/bin/as 
--with-ld=/usr/ccs/bin/ld --disable-nls
Thread model: posix
gcc version 3.2

Also fails with
  gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

Here are the .i contents - brief, so you get contents instead of attachment
# 1 "/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c"
# 11 "/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c"
const int PRICE_SIZE = 15;

int main () {
  char validPriceStr[][PRICE_SIZE] = {
  "111111", "0.123456", "999999", "3 1/2", "4 7/256",
  "5/8", "1 2/3", "0.00000000001", "12.12  ", "5 3 /8",
  "6.9999999999"
  };
# 56 "/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c"
  return 1;
}

Compiler output:
/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c: In function `main':
/ioi/users/andrewk/BP74/2.4/lib/brassii/test/test_ustring.c:18: Internal 
compiler error in size_binop, at fold-const.c:2014
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Changing PRICE_SIZE to a #define works around this bug.
Comment 1 Andrew Pinski 2003-09-08 14:10:19 UTC
Related to bug 10089.
Confirmed on the mainline (20030907).
Reduced a little more:
const int PRICE_SIZE = 15;
int main () {
  char validPriceStr[][PRICE_SIZE] = {" "
  };
  return 1;
}
This is not a regression, just like 10089.
Comment 2 Andrew.Krassowski@brass.com 2003-09-08 14:37:17 UTC
Subject: RE:  Internal compiler error in size_binop, at fold-const.c:2014

Wow - quick response!

Sorry - when I searched "summary" for "internal compiler error"
I got no results, so I thought this was brand-spanking new.

My construct, using 
const int XX_SIZE = 15;

is a real-world usage, resulting from a coding standard directive to
upgrade #define's to const int's.

I'm not sure that a non-const variable
should be allowed to declare array sizes.

Thanks and keep up the great work!

Andy

-----Original Message-----
From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
Sent: Monday, September 08, 2003 10:10 AM
To: Krassowski, Andrew
Subject: [Bug c/12207] Internal compiler error in size_binop, at
fold-const.c:2014


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT*
gcc-bugs@gcc.gnu.org.

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


pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
------------------------------------------------------------------------
----
  BugsThisDependsOn|                            |10089
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|0000-00-00 00:00:00         |2003-09-08 14:10:19
               date|                            |


------- Additional Comments From pinskia at gcc dot gnu dot org
2003-09-08 14:10 -------
Related to bug 10089.
Confirmed on the mainline (20030907).
Reduced a little more:
const int PRICE_SIZE = 15;
int main () {
  char validPriceStr[][PRICE_SIZE] = {" "
  };
  return 1;
}
This is not a regression, just like 10089.



------- You are receiving this mail because: -------
You reported the bug, or are watching the reporter.
Comment 3 Andrew Pinski 2003-09-08 14:44:08 UTC
Actually it is allowed by the C99 standard (this is really a GCC extension from ways back and was 
incorporated into the standard for ANSI/ISO C99).

The best way to search for related bugs is to search for where they die in this case, size_binop  
and not just  "internal error".
Comment 4 Denis Rouleau 2003-10-02 19:15:15 UTC
Created attachment 4883 [details]
.i file without non-constant value in array definition
Comment 5 Denis Rouleau 2003-10-02 19:21:14 UTC
I'm encountering the same bug but without apparent non-constant in array
definition. Perhaps this will help getting a patch.

Compiling an ECOS file (i386 target)

.i file attached

Command line
------------
i386-elf-gcc -c  -I/ecos-f/cygwin/home/Denis/ecos_dev/1stredboot_install/include
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/tests -I.
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src/ -Wall -Wpointer-arith
-Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc
-finit-priority -save-temps -Wp,-MD,src/hal_misc.tmp -o
src/hal_i386_arch_hal_misc.o
/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src/hal_misc.c
cc1: Internal compiler error in size_binop, at fold-const.c:2014


gcc version
------------
i386-elf-gcc -c  -I/ecos-f/cygwin/home/Denis/ecos_dev/1stredboot_install/include
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/tests -I.
-I/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src/ -Wall -Wpointer-arith
-Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2
-ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc
-finit-priority -save-temps -Wp,-MD,src/hal_misc.tmp -o
src/hal_i386_arch_hal_misc.o
/opt/ecos/ecos-2.0/packages/hal/i386/arch/v2_0/src/hal_misc.c
cc1: Internal compiler error in size_binop, at fold-const.c:2014

system
------
Pentium 4, Windows 98, cygwin 3.3.1

[discalimer] first gcc bug report. I read the instructions and I hope I haven't
missed anything;-)
Comment 6 Hans 2004-01-29 16:10:10 UTC
Created attachment 5610 [details]
Problems when compiling with win98
Comment 7 Christian Grothoff 2004-02-06 03:22:04 UTC
I get the "same" ICE doing something quite different.  
I was using gcj (gcc (GCC) 3.3.3 20040125 (prerelease) (Debian)). I get the message  
compiling a rather trivial method without any arrays (I've shortened the package names):  
  
Method public  accept(Interpreter ) -> void  
  
0       aload_1  
1       aload_0  
2       invokevirtual #5 <Method Interpreter.visit_FLOAD (LFLOAD;)V>  
5       return  
  
GCC output:  
FLOAD.java: In class `FLOAD':  
FLOAD.java: In method `accept(Interpreter)':  
FLOAD.java:0: Internal compiler error in size_binop, at fold-const.c:2017  
Please submit a full bug report,  
with preprocessed source if appropriate.  
  
If someone wants the code to reproduce this problem, don't hesitate to contact me. 
Comment 8 Volker Reichelt 2004-05-06 13:01:47 UTC
Andrew's testcase cfrom comment #1 now compiles on tree-ssa.
Fixed by Richard's patch

http://gcc.gnu.org/ml/gcc-cvs/2004-05/msg00129.html
Comment 9 Andrew Pinski 2004-05-06 14:23:32 UTC
Suspending as fixed for the tree-ssa.
Comment 10 Andrew Pinski 2004-05-13 11:52:45 UTC
Fixed for 3.5.0 by the merge of the tree-ssa.
Comment 11 Volker Reichelt 2004-08-18 12:15:44 UTC
The bug reappeared.
Comment 12 Volker Reichelt 2004-08-18 12:16:27 UTC
It is now tracked in PR 16409.

*** This bug has been marked as a duplicate of 16409 ***