Bug 32521 - [4.2] vrp_evaluate_conditional_warnv (tree-vrp.c:4186) at -O3 -ffast-math -ftree-vectorize -march=native
Summary: [4.2] vrp_evaluate_conditional_warnv (tree-vrp.c:4186) at -O3 -ffast-math -ft...
Status: RESOLVED DUPLICATE of bug 32096
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 29975
  Show dependency treegraph
 
Reported: 2007-06-27 14:44 UTC by Joost VandeVondele
Modified: 2007-06-27 18:54 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joost VandeVondele 2007-06-27 14:44:04 UTC
as discussed in PR 29975 CP2K gets miscompiled by gfortran 4.2.0 (see comments 119 to 125). 

sources (src/all.f90) can be obtained from:

http://www.pci.unizh.ch/vandevondele/tmp/CP2K_gcc_2007_06.tgz

and are miscompiled with

-O3 -ffast-math -ftree-vectorize -march=native

the module that gets miscompiled is qs_neighbor_lists. 

under valgrind, compilation of that module shows:

valgrind --tool=memcheck
/data03/vondele/gcc_4_2_0/build/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951
qs_neighbor_lists.f90 -march=k8 -mtune=k8 -quiet -dumpbase
qs_neighbor_lists.f90 -auxbase qs_neighbor_lists -O3 -version -ffast-math
-ftree-vectorize -ftree-vectorizer-verbose=1 -I
/data03/vondele/gcc_4_2_0/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude
-o /tmp/ccoFFIrV.s


==30523== Conditional jump or move depends on uninitialised value(s)
==30523==    at 0x706E08: vrp_evaluate_conditional_warnv (tree-vrp.c:4186)
==30523==    by 0x706F9C: vrp_evaluate_conditional (tree-vrp.c:4318)
==30523==    by 0x4B6E9F: substitute_and_fold (tree-ssa-propagate.c:1053)
==30523==    by 0x700F04: execute_vrp (tree-vrp.c:5318)
==30523==    by 0x6F9F27: execute_one_pass (passes.c:881)
==30523==    by 0x6FA08B: execute_pass_list (passes.c:932)
==30523==    by 0x6FA09D: execute_pass_list (passes.c:933)
==30523==    by 0x48CCCD: tree_rest_of_compilation (tree-optimize.c:463)
==30523==    by 0x742363: cgraph_expand_function (cgraphunit.c:1244)
==30523==    by 0x742C8D: cgraph_optimize (cgraphunit.c:1309)
==30523==    by 0x4633DC: gfc_be_parse_file (f95-lang.c:307)
==30523==    by 0x6DBF92: toplev_main (toplev.c:1033)

as discussed in PR29975, the combination of options above is needed to trigger the bug.
Comment 1 Joost VandeVondele 2007-06-27 14:59:48 UTC
this could be similar to 

PR 32006

as it had a similar valgrind trace.

That bug was marked as a duplicate of another cp2k bug

PR 32018
Comment 2 Joost VandeVondele 2007-06-27 18:33:39 UTC
Reduced testcase:

vondele@pcihopt3:/scratch/vondele/clean/cp2k/obj/Linux-x86-64-gfortran/sopt> cat test.f90
  SUBROUTINE build_qs_neighbor_lists()
    INTEGER, PARAMETER :: dp=KIND(0.0D0)
    REAL(dp), ALLOCATABLE, DIMENSION(:) :: c_radius
    INTEGER :: nkind,istat
    REAL(dp) :: alpha

    ALLOCATE (c_radius(nkind),STAT=istat)
    IF (istat /= 0) CALL stop_memory()
    c_radius = 0.5_dp*SQRT(-LOG(3.5_dp*alpha**3*1.e-12_dp))/alpha

  END SUBROUTINE build_qs_neighbor_lists

valgrind --tool=memcheck   /data03/vondele/gcc_4_2_0/build/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 test.f90 -march=k8 -mtune=k8 -quiet -dumpbase test.f90 -auxbase qs_neighbor_lists -O3 -version -ffast-math  -ftree-vectorize -I /data03/vondele/gcc_4_2_0/build/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude
==3990== Memcheck, a memory error detector.
==3990== Copyright (C) 2002-2007, and GNU GPL'd, by Julian Seward et al.
==3990== Using LibVEX rev 1732, a library for dynamic binary translation.
==3990== Copyright (C) 2004-2007, and GNU GPL'd, by OpenWorks LLP.
==3990== Using valgrind-3.2.3, a dynamic binary instrumentation framework.
==3990== Copyright (C) 2000-2007, and GNU GPL'd, by Julian Seward et al.
==3990== For more details, rerun with: -v
==3990==
GNU F95 version 4.2.0 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
==3990== Conditional jump or move depends on uninitialised value(s)
==3990==    at 0x706E08: vrp_evaluate_conditional_warnv (tree-vrp.c:4186)
==3990==    by 0x706F9C: vrp_evaluate_conditional (tree-vrp.c:4318)
==3990==    by 0x4B6E9F: substitute_and_fold (tree-ssa-propagate.c:1053)
==3990==    by 0x700F04: execute_vrp (tree-vrp.c:5318)
==3990==    by 0x6F9F27: execute_one_pass (passes.c:881)
==3990==    by 0x6FA08B: execute_pass_list (passes.c:932)
==3990==    by 0x6FA09D: execute_pass_list (passes.c:933)
==3990==    by 0x48CCCD: tree_rest_of_compilation (tree-optimize.c:463)
==3990==    by 0x742363: cgraph_expand_function (cgraphunit.c:1244)
==3990==    by 0x742C8D: cgraph_optimize (cgraphunit.c:1309)
==3990==    by 0x4633DC: gfc_be_parse_file (f95-lang.c:307)
==3990==    by 0x6DBF92: toplev_main (toplev.c:1033)
==3990==                                                                                  
Comment 3 Andrew Pinski 2007-06-27 18:54:07 UTC
This was fixed in 4.2.1 already by:
2007-05-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

        * tree-vrp.c (compare_names): Initialize sop.

Which was applied for PR 32096.

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