Opened 8 years ago

Closed 3 years ago

#3645 closed defect (fixed)

Modelica.Utilities.Files.removeFile doesn't work

Reported by: casella Owned by: somebody
Priority: critical Milestone: 1.16.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Run the attached model, which opens a file, writes something to it, closes it and then removes it. At the end of the process the file is still there, yet no error is generated.

Attachments (1)

TestDelete.mo (772 bytes) - added by casella 8 years ago.

Download all attachments as: .zip

Change History (22)

Changed 8 years ago by casella

comment:1 Changed 8 years ago by sjoelund.se

removeFile("file.txt"); is not part of the flattened code for some reason :) I assume because it was not marked impure in MSL.

comment:2 Changed 8 years ago by sjoelund.se

Seems like it is marked impure in MSL, but not printed if the function has the impure annotation. Would need some more time to figure out what was wrong...

comment:3 Changed 8 years ago by sjoelund.se

See also m:#1886. We now remove the print functions, but the other parts probably behave as expected.

comment:4 Changed 8 years ago by casella

Can we implement the simple heuristics proposed here?

comment:5 Changed 8 years ago by sjoelund.se

Nope. We don't know if the function calls external functions...

comment:6 Changed 8 years ago by casella

Too bad. BTW, I understand the currently impelmented heuristics is that functions with no output are considered impure. However, I have some test cases where the behaviour changes for better if I also add the impure keyword to the declaration.

comment:7 Changed 8 years ago by sjoelund.se

No, functions with no output are not considered impure. Because then you could not call print, hashtables functions, etc as used in MetaModelica.

comment:8 Changed 8 years ago by casella

Sorry, I am totally confused then. What kind of heuristics is currently available in OMC to detect impure function calls with constant inputs and avoid optimizing them away at initialization?

comment:9 Changed 8 years ago by sjoelund.se

Pretty much none. We look for __OpenModelica_Impure=true, or we run with -d=nogen which disables generation of dll's (but since some external functions are structurally necessary, some external calls are allowed and are handled by -d=evalfunc).

comment:10 Changed 8 years ago by casella

Aha. On 22 Feb 2016 9:25 you wrote me on Skype

I think we detect that they don't return anything, so we consider them impure :)

I was misled by that...

comment:11 Changed 8 years ago by sjoelund.se

Well. I think we try to not evaluate them (at least in some instances). But not by considering them the same as impure (since impure functions are more special).

comment:12 Changed 8 years ago by casella

Which is even worse from the user's point of view, because sometimes they work as expected and sometimes they don't, without any obvious pattern...

comment:13 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:14 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:15 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:16 Changed 7 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:17 Changed 6 years ago by casella

  • Milestone changed from 1.12.0 to 1.13.0

Milestone moved to 1.13.0 due to 1.12.0 already being released.

comment:18 Changed 5 years ago by casella

  • Milestone changed from 1.13.0 to 1.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:19 Changed 5 years ago by casella

  • Milestone changed from 1.14.0 to 1.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:20 Changed 3 years ago by casella

  • Milestone changed from 1.16.0 to 1.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:21 Changed 3 years ago by perost

  • Component changed from Run-time to New Instantiation
  • Milestone changed from 1.17.0 to 1.16.0
  • Resolution set to fixed
  • Status changed from new to closed

This works with the new frontend now which doesn't remove any of the calls and marks functions as impure correctly.

Note: See TracTickets for help on using tickets.