https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97652
Bug ID: 97652 Summary: New pdt14 failure after g:617695cdc2b3d950f1e4deb5ea85d5cc302943f4 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: hubicka at gcc dot gnu.org Target Milestone: --- pdt14 is miscompiled with -fipa-modref. This is triggered by handling fnspec, but it seems to only trigger latent problem. The only disambiguations are: ipa-modref: call stmt push_8 (&root, &C.4105); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 ipa-modref: call stmt push_8 (&root, &C.4104); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 ipa-modref: call stmt push_8 (&root, &C.4103); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 ipa-modref: call stmt push_8 (&root, &C.4105); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 ipa-modref: call stmt push_8 (&root, &C.4104); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 ipa-modref: call stmt push_8 (&root, &C.4103); ipa-modref: call to push_8/6 does not clobber ref: __vtab_link_module_Pdtlink_8._deallocate alias sets: 12->11 these ought to be safe since __vtab_link_module_Pdtlink_8 is readonly in the testcase. With LTO we detect that variable as such (and the testcase stil work without modref and fails different with modref). fre3 does quite a lot of additional changes and I am not sure what gets wrong here: __attribute__((externally_visible)) main (integer(kind=4) argc, character(kind=1) * * argv) { + struct array01_unknown cdesc.10; + struct array01_unknown cdesc.9; + real(kind=8) res; + struct Pdtlink_8 * previous; + struct Pdtlink_8 * current; + real(kind=8) res; struct pdtlink_8 * root; static integer(kind=4) options.11[7] = {2150, 4095, 1, 1, 1, 0, 31}; - real(kind=8) _7; - integer(kind=4) _8; - real(kind=8) _9; - integer(kind=4) _10; - real(kind=8) _11; - integer(kind=4) _12; - real(kind=8) _13; - integer(kind=4) _14; + struct Pdtlink_8 * _15; + struct Pdtlink_8 * _17; + struct Pdtlink_8 * _21; + struct Pdtlink_8 * _22; + void (*<T5d4>) () _23; + struct Pdtlink_8 * _25; + void (*<T5d4>) () _26; <bb 2> [local count: 1073741824]: _gfortran_set_args (argc_2(D), argv_3(D)); @@ -1972,52 +2120,75 @@ push_8 (&root, &C.4103); push_8 (&root, &C.4104); push_8 (&root, &C.4105); - _7 = pop_8 (&root); - _8 = (integer(kind=4)) _7; - if (_8 != 3) - goto <bb 3>; [0.04%] + _15 = MEM[(struct Pdtlink_8 * &)&root]; + if (_15 != 0B) + goto <bb 3>; [70.00%] else - goto <bb 4>; [99.96%] + goto <bb 11>; [30.00%] - <bb 3> [local count: 429496]: - _gfortran_stop_numeric (1, 0); - - <bb 4> [local count: 1073312329]: - _9 = pop_8 (&root); - _10 = (integer(kind=4)) _9; - if (_10 != 2) - goto <bb 5>; [0.04%] + <bb 3> [local count: 75913541732]: + # current_16 = PHI <_15(2), _17(3)> + # previous_29 = PHI <_15(2), current_16(3)> + _17 = current_16->next; + if (_17 == 0B) + goto <bb 4>; [0.00%] else - goto <bb 6>; [99.96%] - - <bb 5> [local count: 429324]: - _gfortran_stop_numeric (2, 0); + goto <bb 3>; [100.00%] - <bb 6> [local count: 1072883005]: - _11 = pop_8 (&root); - _12 = (integer(kind=4)) _11; - if (_12 != 1) - goto <bb 7>; [0.04%] + <bb 4> [count: 0]: + res_19 = current_16->n; + _21 = previous_29->next; + if (_21 == 0B) + goto <bb 5>; [30.00%] else - goto <bb 8>; [99.96%] + goto <bb 8>; [70.00%] - <bb 7> [local count: 429152]: - _gfortran_stop_numeric (3, 0); + <bb 5> [count: 0]: + _22 = _15->next; + if (_22 != 0B) + goto <bb 6>; [70.00%] + else + goto <bb 7>; [30.00%] - <bb 8> [local count: 1072453853]: - _13 = pop_8 (&root); - _14 = (integer(kind=4)) _13; - if (_14 != 0) - goto <bb 9>; [0.04%] + <bb 6> [count: 0]: + MEM <c_char[8]> [(struct dtype_type *)&cdesc.9 + 24B] = {}; + cdesc.9.dtype.elem_len = 24; + cdesc.9.dtype.rank = 1; + cdesc.9.dtype.type = 11; + cdesc.9.dim[0].lbound = 1; + cdesc.9.dim[0].stride = 1; + cdesc.9.dim[0].ubound = 1; + cdesc.9.data = _22; + _23 = __vtab_link_module_Pdtlink_8._deallocate; + __builtin_unreachable (); + + <bb 7> [count: 0]: + __builtin_unreachable (); + + <bb 8> [count: 0]: + _25 = _21->next; + if (_25 != 0B) + goto <bb 9>; [70.00%] else - goto <bb 10>; [99.96%] + goto <bb 10>; [30.00%] + + <bb 9> [count: 0]: + MEM <c_char[8]> [(struct dtype_type *)&cdesc.10 + 24B] = {}; + cdesc.10.dtype.elem_len = 24; + cdesc.10.dtype.rank = 1; + cdesc.10.dtype.type = 11; + cdesc.10.dim[0].lbound = 1; + cdesc.10.dim[0].stride = 1; + cdesc.10.dim[0].ubound = 1; + cdesc.10.data = _25; + _26 = __vtab_link_module_Pdtlink_8._deallocate; + __builtin_unreachable (); - <bb 9> [local count: 428981]: - _gfortran_stop_numeric (4, 0); + <bb 10> [count: 0]: + __builtin_unreachable (); - <bb 10> [local count: 1072024872]: - root ={v} {CLOBBER}; - return 0; + <bb 11> [local count: 128815]: + _gfortran_stop_numeric (1, 0);