Ticket #155 (accepted defect)

Opened 5 years ago

Last modified 4 years ago

problem with CFG (un)structure resulting from CYCLE or labelled EXIT

Reported by: utke Owned by: utke
Priority: major Milestone:
Component: Open64 front end Keywords:
Cc:

Description (last modified by utke) (diff)

see test case <nowiki>UnStruct?_controlflow_loop4</nowiki>

Attachments

cfg_unstructured.dot.pdf Download (4.6 KB) - added by utke 5 years ago.
CFG

Change History

Changed 5 years ago by utke

CFG

  Changed 4 years ago by utke

  • status changed from new to accepted
  • description modified (diff)
  • summary changed from problem with CFG (un)structure resulting either CYCLE or labelled EXIT to problem with CFG (un)structure resulting from CYCLE or labelled EXIT

follow-up: ↓ 4   Changed 4 years ago by utke

the input code is already incorrectly parsed for the do loop:

(DO_LOOP V V ()

(IDNAME V V ((st "I" 2 2) 0))
(STID V I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0)

(LDID I4 I4 ((st "LB" 2 4) 0 (ty ".predef_I4" 4 4) 0)))

(NE I4 I4 ()

(LDID I4 I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0))
(LDID I4 I4 ((st "UB" 2 6) 0 (ty ".predef_I4" 4 4) 0)))

(STID V I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0)

(ADD I4 V ()

(LDID I4 I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0))
(LDID I4 I4 ((st "STEP" 2 5) 0 (ty ".predef_I4" 4 4) 0))))

Note the "NE" instead of the "LE" for the condition I.le.UB in the loop.
Consequently the generated code executes incorrectly.

  Changed 4 years ago by utke

  • component changed from OpenADFortTk to Open64 front end

in reply to: ↑ 2   Changed 4 years ago by utke

Replying to utke:

the input code is already incorrectly parsed for the do loop:
(DO_LOOP V V ()
(IDNAME V V ((st "I" 2 2) 0))
(STID V I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0)
(LDID I4 I4 ((st "LB" 2 4) 0 (ty ".predef_I4" 4 4) 0)))
(NE I4 I4 ()
(LDID I4 I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0))
(LDID I4 I4 ((st "UB" 2 6) 0 (ty ".predef_I4" 4 4) 0)))
(STID V I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0)
(ADD I4 V ()
(LDID I4 I4 ((st "I" 2 2) 0 (ty ".predef_I4" 4 4) 0))
(LDID I4 I4 ((st "STEP" 2 5) 0 (ty ".predef_I4" 4 4) 0))))

Note the "NE" instead of the "LE" for the condition I.le.UB in the loop.
Consequently the generated code executes incorrectly.

The "NE" is a consequence of Open64 changeset 803 which tried to disambiguate constant from
variable stride by introducing a NE condition which is normally
translated back into a do loop but not in the case of unstructured control flow where
the condition occurs verbatim in a if statement.
Because in the normal do loop unparsing the contents of the right operand contains the "upper bound" that can be unparsed w/o modification the proper place for a fix is
the FortTk? logic for unstructured control flow.

Note: See TracTickets for help on using tickets.