public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: p.van-hoof@qub.ac.uk To: gcc-gnats@gcc.gnu.org Cc: p.van-hoof@qub.ac.uk Subject: optimization/10087: optimizer produces wrong code when indexing malloc'ed 2D array Date: Fri, 14 Mar 2003 22:16:00 -0000 [thread overview] Message-ID: <200303142001.h2EK1S3v025754@scooby.star.fleet> (raw) >Number: 10087 >Category: optimization >Synopsis: optimizer produces wrong code when indexing malloc'ed 2D array >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: wrong-code >Submitter-Id: net >Arrival-Date: Fri Mar 14 22:16:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Peter van Hoof >Release: 3.3 20030310 (prerelease) >Organization: Queen's University of Belfast >Environment: System: SunOS scooby 5.9 Generic_112233-04 sun4u sparc SUNW,Sun-Blade-100 Architecture: sun4 host: sparc-sun-solaris2.9 build: sparc-sun-solaris2.9 target: sparc-sun-solaris2.9 configured with: /scratch/temp/ss/gcc-20030310/configure --prefix=/opt/local/gcc330 >Description: In the attached code a two-dimensional array of structs is malloc'ed, then the first field of that struct is initialized to 1 for all array members. Finally the minimum value of all these fields is determined by looping over the array again. This should of course return 1, but the actual result is 1.039778e-312. This code runs OK with gcc 3.2.2 >How-To-Repeat: scooby> gcc -v -save-temps -O2 bug.c Reading specs from /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/specs Configured with: /scratch/temp/ss/gcc-20030310/configure --prefix=/opt/local/gcc330 Thread model: posix gcc version 3.3 20030310 (prerelease) /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/cc1 -E -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 -Dsparc -D__sparc__ -D__sparc -D__GCC_NEW_VARARGS__ -Acpu=sparc -Amachine=sparc bug.c -O2 bug.i ignoring nonexistent directory "/opt/local/gcc330/sparc-sun-solaris2.9/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /opt/local/gcc330/include /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/include /usr/include End of search list. /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/cc1 -fpreprocessed bug.i -quiet -dumpbase bug.c -auxbase bug -O2 -version -o bug.s GNU C version 3.3 20030310 (prerelease) (sparc-sun-solaris2.9) compiled by GNU C version 3.3 20030310 (prerelease). GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 /usr/ccs/bin/as -V -Qy -s -o bug.o bug.s /usr/ccs/bin/as: Sun WorkShop 6 update 2 Compiler Common 6.2 Solaris_9_CBE 2001/04/02 /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/collect2 -V -Y P,/usr/ccs/lib:/usr/lib -Qy /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/crt1.o /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/crti.o /usr/ccs/lib/values-Xa.o /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/crtbegin.o -L/opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3 -L/usr/ccs/bin -L/usr/ccs/lib -L/opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/../../.. bug.o -lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/crtend.o /opt/local/gcc330/lib/gcc-lib/sparc-sun-solaris2.9/3.3/crtn.o ld: Software Generation Utilities - Solaris Link Editors: 5.9-1.373 scooby> a.out result 1.039778e-312 This is the input: begin 644 bug.i.bz2 M0EIH.3%!6293649DV94 !G__@'PT! 1;?___<R8>#K____I@$M]X!<[A]L ^ M][V/>7W-A]S(/K[N]/'H>>S?4@UNWRT<@I].[>F^>X*^\&]#=[@X2*$TBGZ1 MB:GJ/ CTI^J/4/*9#90#)D!ZC:C0"4T("$TT$IY4\T*-,$T&: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C R,=%%*C*4-,-[J3?I/+EWQP<5;90I144%$55%4$0Z9Q%%CP!#8%5 58* MH"NY ]**58RLEH#(AA 722)@0"YX=Y<#;G5F0SI"'3-$FIQ@,TK?*;(DG$(8 M"YB*\7K??^$1'9J:[0@)2%E!U/%U>TOH?+V?'UYYYGKV^IW@-ZI)'$](8$/$ MEI;$[NXN. 2D.A2IOY<NO1P$.TU;8Q+&P+$"2%N^R15:-2@V;+I:&HA-0ACU M?1XPGT4>T:A4GZ;8HB'YTV@;&+-"XF8$TAL26P(Y"XX)8C27/RV;*ZP<D&V* M,#0;FN7$4_P=1.=T=*7%$5O!%[RM<)*'93.6WR!9JD'332@$MZS+EZ6+#(P6 M#&$"$&&DK=Y)NM-*GIPL/-!#+T>7'X*&/'!T/-W2$9-P'7:T6>R0B?,554:G ML8.?#(F!SAT)*"CM\Y:U$D2Z$37,T[=;J:GPYXX*^Y%486C"BQ;,0$S1 AO ;9A)-=L60(+&=YYAF8*06!]HNY(IPH2",R;,J end >Fix: Using a lower level of optimization works around the bug. >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-03-14 22:16 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-03-14 22:16 p.van-hoof [this message] 2003-03-14 22:38 bangerth 2003-03-14 23:26 Peter van Hoof 2003-03-14 23:27 bangerth 2003-03-15 0:56 Peter van Hoof
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=200303142001.h2EK1S3v025754@scooby.star.fleet \ --to=p.van-hoof@qub.ac.uk \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).