From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10294 invoked by alias); 26 Nov 2001 19:26:02 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 10250 invoked by uid 71); 26 Nov 2001 19:26:01 -0000 Resent-Date: 26 Nov 2001 19:26:01 -0000 Resent-Message-ID: <20011126192601.10249.qmail@sourceware.cygnus.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, "Dennis Altrogge" Received:(qmail 6786 invoked from network); 26 Nov 2001 19:20:19 -0000 Received: from unknown (HELO zcars0m9.nortelnetworks.com) (47.129.242.157) by hostedprojects.ges.redhat.com with SMTP; 26 Nov 2001 19:20:19 -0000 Received: from zcars04f.ca.nortel.com (zcars04f.ca.nortel.com [47.129.242.57]) by zcars0m9.nortelnetworks.com (8.11.0/8.11.0) with ESMTP id fAQJJcd29651 for ; Mon, 26 Nov 2001 14:19:38 -0500 (EST) Received: from zmers013 (actually zmers013.ca.nortel.com) by zcars04f.ca.nortel.com; Mon, 26 Nov 2001 14:20:06 -0500 Received: from mailhost.BayNetworks.COM (actually ns2.baynetworks.com) by zmers013; Mon, 26 Nov 2001 14:19:53 -0500 Received: from fedex.engwest.baynetworks.com (fedex.engwest.baynetworks.com [134.177.110.46]) by mailhost.BayNetworks.COM (8.9.1/8.8.8) with ESMTP id LAA07672 for ; Mon, 26 Nov 2001 11:08:44 -0800 (PST) Received: from farside.engwest (farside [134.177.150.217]) by fedex.engwest.baynetworks.com (8.8.8+Sun/8.8.8) with ESMTP id LAA09072 for ; Mon, 26 Nov 2001 11:19:49 -0800 (PST) Received: (from altrogge@localhost) by farside.engwest (8.8.8+Sun/8.8.8) id LAA04380; Mon, 26 Nov 2001 11:19:45 -0800 (PST) Message-Id:<200111261919.LAA04380@farside.engwest> Date: Tue, 20 Nov 2001 23:24:00 -0000 From: "Dennis Altrogge" To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version:3.113 Subject: c/4949: switch + 5 cases + -O2 or no O crashes gcc-3.0.2 X-SW-Source: 2001-11/txt/msg00626.txt.bz2 List-Id: >Number: 4949 >Category: c >Synopsis: switch + 5 cases + -O2 or no O crashes gcc-3.0.2 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Nov 26 11:26:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Dennis Altrogge >Release: 3.0.2 >Organization: Nortel Networks >Environment: System: SunOS farside 5.6 Generic_105181-25 sun4m sparc SUNW,SPARCstation-20 Architecture: sun4 host: sparc-sun-solaris2.6 build: sparc-sun-solaris2.6 target: m68k-unknown-elf configured with: ../gcc-3.0.2/configure --target=m68k-elf --with-newlib --prefix=/engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf >Description: The enclosed code crashes gcc-3.0.2 with optimization levels -O2 or without O but not with -O. Some lines that make the function legal are #ifed out but the crash occurs with or without them. Changing any of the case statements seems to fix the problem. I haven't tried the problem on previous versions of gcc yet. ######## error message follows ########### gmake -f Makefile.gnu badcode.o /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/bin/m68k-elf-gcc -c -g -Wall -v -save-temps \ -m5200 -Wa,-register-prefix-optional badcode.c Reading specs from /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/lib/gcc-lib/m68k-elf/3.0.2/specs Configured with: ../gcc-3.0.2/configure --target=m68k-elf --with-newlib --prefix=/engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf Thread model: single gcc version 3.0.2 /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/lib/gcc-lib/m68k-elf/3.0.2/cpp0 -lang-c -v -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=2 -Dmc68000 -D__embedded__ -D__mc68000__ -D__embedded__ -D__mc68000 -Asystem=embedded -Amachine=mc68000 -D__NO_INLINE__ -D__STDC_HOSTED__=1 -Wall -Dmcf5200 -D__mcf5200__ -D__mcf5200 badcode.c badcode.i GNU CPP version 3.0.2 (cpplib) (68k, MIT syntax) ignoring nonexistent directory "/engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/m68k-elf/sys-include" #include "..." search starts here: #include <...> search starts here: /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/lib/gcc-lib/m68k-elf/3.0.2/include /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/m68k-elf/include End of search list. /engwest/agt_tools/compilers/gcc/3.0.2-sol26-m68k-elf/lib/gcc-lib/m68k-elf/3.0.2/cc1 -fpreprocessed badcode.i -quiet -dumpbase badcode.c -m5200 -g -Wall -version -o badcode.s GNU CPP version 3.0.2 (cpplib) (68k, MIT syntax) GNU C version 3.0.2 (m68k-elf) compiled by GNU C version 2.95.2 19991024 (release). badcode.c: In function `c_SrecProcFile': badcode.c:51: Insn does not satisfy its constraints: (insn 85 19 45 (set (reg:QI 8 %a0) (mem/f:QI (plus:SI (reg/f:SI 14 %a6) (const_int -1 [0xffffffff])) 0)) 37 {*m68k.md:1060} (nil) (nil)) badcode.c:51: Internal compiler error in final_scan_insn, at final.c:2876 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. gmake: *** [badcode.o] Error 1 >How-To-Repeat: ########### this is the badcode.c file ################### ############ crashes with optimization -O2 or not O but NOT with -O ##### /*======================================================================= srec.c srec.c: In function `c_SrecProcFile': srec.c:53: Insn does not satisfy its constraints: (insn 85 19 45 (set (reg:QI 8 %a0) (mem/f:QI (plus:SI (reg/f:SI 14 %a6) (const_int -1 [0xffffffff])) 0)) 37 {*m68k.md:1060} (nil) (nil)) srec.c:53: Internal compiler error in final_scan_insn, at final.c:2876 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. gmake: *** [srec.o] Error 1 * with gcc-core-3.0.2 for m68k-elf binutils-2.11.2 and newlib-1.9.0 *======================================================================== */ #if 0 /* this is not necessary to cause the crash */ signed char c_GetDlChar( void ); #endif signed char c_SrecProcFile( ) { signed char c_SrecType; while( 1 ) /* forever */ { #if 0 /* this is not necessary to cause the crash */ if( ( c_SrecType = c_GetDlChar() ) < 0 ) return c_SrecType; #endif switch( c_SrecType ) { /* removing any of these cases fixes it */ case '0': break; case '3': break; case '5': break; case '8': case '9': return 0; } } } ################## this is the badcode.i file ###################### # 23 "badcode.c" signed char c_SrecProcFile( ) { signed char c_SrecType; while( 1 ) { switch( c_SrecType ) { case '0': break; case '3': break; case '5': break; case '8': case '9': return 0; } } } ############## this is the badcode.s file ######################### .file "badcode.i" .stabs "/bnw/home/altrogge/tiger/",100,0,0,.Ltext0 .stabs "badcode.i",100,0,0,.Ltext0 .text .Ltext0: .stabs "gcc2_compiled.",60,0,0,0 .stabs "int:t(0,1)=r(0,1);-2147483648;2147483647;",128,0,0,0 .stabs "char:t(0,2)=r(0,2);0;127;",128,0,0,0 .stabs "long int:t(0,3)=r(0,3);-2147483648;2147483647;",128,0,0,0 .stabs "unsigned int:t(0,4)=r(0,4);0000000000000;0037777777777;",128,0,0,0 .stabs "long unsigned int:t(0,5)=r(0,5);0000000000000;0037777777777;",128,0,0,0 .stabs "long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;",128,0,0,0 .stabs "long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;",128,0,0,0 .stabs "short int:t(0,8)=@s16;r(0,8);-32768;32767;",128,0,0,0 .stabs "short unsigned int:t(0,9)=@s16;r(0,9);0;65535;",128,0,0,0 .stabs "signed char:t(0,10)=@s8;r(0,10);-128;127;",128,0,0,0 .stabs "unsigned char:t(0,11)=@s8;r(0,11);0;255;",128,0,0,0 .stabs "float:t(0,12)=r(0,1);4;0;",128,0,0,0 .stabs "double:t(0,13)=r(0,1);8;0;",128,0,0,0 .stabs "long double:t(0,14)=r(0,1);12;0;",128,0,0,0 .stabs "complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;",128,0,0,0 .stabs "complex float:t(0,16)=r(0,16);8;0;",128,0,0,0 .stabs "complex double:t(0,17)=r(0,17);16;0;",128,0,0,0 .stabs "complex long double:t(0,18)=r(0,18);24;0;",128,0,0,0 .stabs "__builtin_va_list:t(0,19)=*(0,20)=(0,20)",128,0,0,0 .stabs "_Bool:t(0,21)=@s8;-16;",128,0,0,0 .stabs "c_SrecProcFile:F(0,10)",36,0,25,c_SrecProcFile .globl c_SrecProcFile .type c_SrecProcFile,@function c_SrecProcFile: .stabs "badcode.c",132,0,0,.Ltext1 .Ltext1: .stabn 68,0,25,.LM1-c_SrecProcFile .LM1: link.w %a6,#-8 .LBB2: .stabn 68,0,26,.LM2-c_SrecProcFile .LM2: nop .L4: .stabn 68,0,34,.LM3-c_SrecProcFile .LM3: >Fix: compile works with -O optimization >Release-Note: >Audit-Trail: >Unformatted: Severity: <[ non-critical | serious | critical ] (one line)> serious icd-on-legal-code