[Bug libfortran/53148] New: [gcc/gfortran-4.7.0 Regression] Incorrect intrinsic function parsing on labeled statements when compiled w/optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53148 Bug #: 53148 Summary: [gcc/gfortran-4.7.0 Regression] Incorrect intrinsic function parsing on labeled statements when compiled w/optimization Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libfortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: jpsinthe...@verizon.net Created attachment 27256 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27256 Compilation and .s files for -O0 and -O2 optimizations Hi, There appears to be a gcc/gfortran-4.7.0 regression occurring for -O optimizations greater than -O0 related to the parsing of labeled statements containing expressions with repeated function calls. For example, a statement like: 10 x = dble(y)*dble(y) will generate a compiler warning, similar to label_opt_issue.f:38:0: warning: '__var_1' is used uninitialized in this function [-Wuninitialized] and at runtime, the expression dble(y)*dble(y) will always evaluate to 0, regardless of the value of y. Expected results are obtained when the code is compiled with default/no optimization, but failure occurs when compiling with -O1 and above. There is nothing special about the use of intrinsic DBLE here, the same behavior occurs for other intrinsic functions (user-defined functions work as expected). In addition, if a more complicated expression is used, for example, 10 x = (1.d0 + exp(y)*exp(y))/z then the same compilation warning occurs, and the value of x is evaluated as x = (1 + 0)/z = 1/z that is, exp(y)*exp(y) evaluates to 0, regardless of y. This issue is not present in gcc/gfortran-4.6.3. The following program demonstrates the issue: C label_opt_issue.f program main real x double precision xsq double precision test_func double precision work_around x = 5. xsq = test_func(x) write(*,*) "function x: ", x, "x*x: ", xsq call test_subr(x,xsq) write(*,*) "subroutine x: ", x, "x*x: ", xsq xsq = work_around(x) write(*,*) "expected x: ", x, "x*x: ", xsq end program subroutine test_subr(x,xsq) real x double precision xsq intrinsic dble goto 10 10 xsq = dble(x)*dble(x) return end subroutine double precision function test_func(x) real x intrinsic dble goto 10 10 test_func = dble(x)*dble(x) return end function double precision function work_around(x) real x intrinsic dble goto 10 10 continue work_around = dble(x)*dble(x) return end function Demonstration code output: With -O1 to -O3 optimization: $ ./label_opt_issue function x:5. x*x:0. subroutine x:5. x*x:0. expected x:5. x*x:25.000 With default optimization: $ ./label_opt_issue function x:5. x*x:25.000 subroutine x:5. x*x:25.000 expected x:5. x*x:25.000 I have attached the label_opt_issue.f compilation logs and temp *.s files for for two cases: default optimization and -O2 optimization. I came across this issue building and testing SCIPY; one test failed which really should not have, and that lead me to a fortran routine using DBLE in the manner above which always evaluated to 0. System info: === gcc/gfortran version/options/system type: $ gfortran -v Using built-in specs. COLLECT_GCC=gfortran COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/lto-wrapper Target: i686-pc-linux-gnu Configured with: /home/bld/gcc-4.7.0-jps_src/gcc-4.7.0/configure --prefix=/usr --libexecdir=/usr/lib --with-gmp=/usr --with-mpfr=/usr --with-system-zlib --enable-shared --enable-checking=release --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-bootstrap --enable-languages=c,c++,fortran --infodir=/usr/share/info --mandir=/usr/share/man Thread model: posix gcc version 4.7.0 (GCC) system: Linux b-movie 3.3.3 #1 Sun Apr 22 21:11:23 EDT 2012 i686 GNU/Linux glibc: 2.15 thanks for your time, John
[Bug fortran/53148] [4.7 Regression] Incorrect intrinsic function parsing on labeled statements when compiled w/ -ffrontend-optimize
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53148 --- Comment #6 from John Stanley 2012-04-30 23:47:03 UTC --- (In reply to comment #5) > Fixed on trunk and 4.7. > > Closing. > > Thanks a lot for the bug report! I rebuilt gcc with cherry-picked patches and all look good. Really appreciate the super-fast response and fix.
[Bug fortran/66331] New: gfortran.dg/continuation_13.f90 execution failure
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66331 Bug ID: 66331 Summary: gfortran.dg/continuation_13.f90 execution failure Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jpsinthemix at verizon dot net Target Milestone: --- Hi, I'm getting the following gfortran testsuite errors for gcc-5.1.0 on an x86_64-pc-linux-gnu system: === gfortran tests === Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/coarray/caf.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/debug/debug.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/dg.exp ... FAIL: gfortran.dg/continuation_13.f90 -O0 execution test FAIL: gfortran.dg/continuation_13.f90 -O1 execution test FAIL: gfortran.dg/continuation_13.f90 -O2 execution test FAIL: gfortran.dg/continuation_13.f90 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/continuation_13.f90 -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: gfortran.dg/continuation_13.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/continuation_13.f90 -O3 -g execution test FAIL: gfortran.dg/continuation_13.f90 -Os execution test Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/goacc/goacc.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/gomp/gomp.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/graphite/graphite.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/guality/guality.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/ieee/ieee.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/lto/lto.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.dg/vect/vect.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.fortran-torture/compile/compile.exp ... Running /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/gfortran.fortran-torture/execute/execute.exp ... The failure occurs in gcc-5.1.0/gcc/testsuite/gfortran.dg/continuation_13.f90:37 1 ! { dg-do run } 2 ! { dg-options "-std=gnu" } 3 ! PR64506 4 character(25) :: astring 5 6 100 format('This format is OK.'& 7 ) 8 200 format('This format now works.'&!comment 9 ) 10 300 format('This format now works.'& !comment 11 ) 12 400 format('This format is OK.' &!comment 13 ) 14 500 format('This format is OK.' & !comment 15 ) 16 600 format('This format now works.'''&!comment 17 ) 18 700 format('This format now works.'''& !comment 19 ) 20 800 format('This is actually ok.'& !comment 21' end' ) 22 write(astring,100) 23 if (astring.ne."This format is OK.") call abort 24 write(astring,200) 25 if (astring.ne."This format now works.") call abort 26 write(astring,300) 27 if (astring.ne."This format now works.") call abort 28 write(astring,400) 29 if (astring.ne."This format is OK.") call abort 30 write(astring,500) 31 if (astring.ne."This format is OK.") call abort 32 write(astring,600) 33 if (astring.ne."This format now works.'") call abort 34 write(astring,700) 35 if (astring.ne."This format now works.'") call abort 36 write(astring,800) 37 if (astring.ne."This is actually ok. end") call abort <-- fails 38 39 end I modified continuation_13.f90 as follows: 1 ! { dg-do run } 2 ! { dg-options "-std=gnu" } 3 ! PR64506 4 character(25) :: astring 5 6 100 format('This format is OK.'& 7 ) 8 200 format('This format now works.'&!comment 9 ) 10 300 format('This format now works.'& !comment 11 ) 12 400 format('This format is OK.' &!comment 13 ) 14 500 format('This format is OK.' & !comment 15 ) 16 600 format('This format now works.'''&!comment 17 ) 18 700 format('This format no
[Bug go/66332] New: goacc/acc_on_device-2.c scan-rtl-dump-times expand testsuite failure
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66332 Bug ID: 66332 Summary: goacc/acc_on_device-2.c scan-rtl-dump-times expand testsuite failure Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: jpsinthemix at verizon dot net CC: cmang at google dot com Target Milestone: --- Hi, I'm getting the following openacc-related testsuite error for gcc-5.1.0 on an x86_64-pc-linux-gnu system: FAIL: c-c++-common/goacc/acc_on_device-2.c scan-rtl-dump-times expand "\\(call [^\\n]* acc_on_device" 0 This failure does not appear to be related to BUG 64850. The failure occurs in gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:27 1 /* Have to enable optimizations, as otherwise builtins won't be expanded. */ 2 /* { dg-additional-options "-O -fdump-rtl-expand" } */ 3 4 #if __cplusplus 5 extern "C" { 6 #endif 7 8 typedef enum acc_device_t { acc_device_X = 123 } acc_device_t; 9 extern int acc_on_device (acc_device_t); 10 11 #if __cplusplus 12 } 13 #endif 14 15 int 16 f (void) 17 { 18 const acc_device_t dev = acc_device_X; 19 return acc_on_device (dev); 20 } 21 22 /* With -fopenacc, we're expecting the builtin to be expanded, so no calls. 23TODO: in C++, even under extern "C", the use of enum for acc_device_t 24perturbs expansion as a builtin, which expects an int parameter. It's fine 25when changing acc_device_t to plain int, but that's not what we're doing in 26. 27{ dg-final { scan-rtl-dump-times "\\\(call \[^\\n\]* acc_on_device" 0 "expand" { xfail c++ } } } */ 28 29 /* { dg-final { cleanup-rtl-dump "expand" } } */ Running: /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/build/gcc/xgcc -B/home/pkgbase/bld/gcc.5.1.0-x86_64-build4/build/gcc/ /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c -fno-diagnostics-show-caret -fdiagnostics-color=never -fopenacc -O -fdump-rtl-expand -ffat-lto-objects -S -o acc_on_device-2.s I get (acc_on_device-2.s): 1 .file "acc_on_device-2.c" 2 .text 3 .globl f 4 .type f, @function 5 f: 6 .LFB0: 7 .cfi_startproc 8 subq$8, %rsp 9 .cfi_def_cfa_offset 16 10 movl$123, %edi 11 callacc_on_device 12 addq$8, %rsp 13 .cfi_def_cfa_offset 8 14 ret 15 .cfi_endproc 16 .LFE0: 17 .size f, .-f 18 .ident "GCC: (GNU) 5.1.0" 19 .section.note.GNU-stack,"",@progbits and (acc_on_device-2.c.191r.expand): 1 2 ;; Function f (f, funcdef_no=0, decl_uid=1846, cgraph_uid=0, symbol_order=0) 3 4 5 ;; Generating RTL for gimple basic block 2 6 7 8 try_optimize_cfg iteration 1 9 10 Merging block 3 into block 2... 11 Merged blocks 2 and 3. 12 Merged 2 and 3 without moving. 13 Removing jump 11. 14 Merging block 4 into block 2... 15 Merged blocks 2 and 4. 16 Merged 2 and 4 without moving. 17 18 19 try_optimize_cfg iteration 2 20 21 22 23 ;; 24 ;; Full RTL generated for this function: 25 ;; 26 (note 1 0 3 NOTE_INSN_DELETED) 27 (note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK) 28 (note 2 3 5 2 NOTE_INSN_FUNCTION_BEG) 29 (insn 5 2 6 2 (set (reg:SI 5 di) 30 (const_int 123 [0x7b])) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 31 (nil)) 32 (call_insn/u 6 5 7 2 (set (reg:SI 0 ax) 33 (call (mem:QI (symbol_ref:DI ("acc_on_device") [flags 0x41] ) [0 __builtin_acc_on_device S1 A8]) 34 (const_int 0 [0]))) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 35 (expr_list:REG_EH_REGION (const_int 0 [0]) 36 (nil)) 37 (expr_list:SI (use (reg:SI 5 di)) 38 (nil))) 39 (insn 7 6 8 2 (set (reg:SI 89) 40 (reg:SI 0 ax)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 41 (nil)) 42 (insn 8 7 9 2 (set (reg:SI 90) 43 (reg:SI 89)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 44 (nil)) 45 (insn 9 8 10 2 (set (reg:SI 87 [ D.1855 ]) 46 (reg:SI 90)) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 47 (nil)) 48 (insn 10 9 14 2 (set (reg:SI 88 [ ]) 49 (reg:SI 87 [ D.1855 ])) /home/pkgbase/bld/gcc.5.1.0-x86_64-build4/gcc-5.1.0/gcc/testsuite/c-c++-common/goacc/acc_on_device-2.c:19 -1 50 (nil)) 51 (insn 14 10 15 2 (set (reg/i:S
[Bug fortran/66331] gfortran.dg/continuation_13.f90 execution failure
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66331 --- Comment #3 from John Stanley --- Wonderful. Thanks much, and sorry I missed 65903. I guess this can be closed.