Opened 10 years ago
Last modified 10 years ago
#2923 new defect
Expressions get simplified even if flag noSimplify is used
Reported by: | Lennart Ochel | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | jan.hagemann@… |
Description
I know the flag noSimplify is a very old one. This could either mean that it is very well tested or that it is long-forgotten and no one cares about it. I can see that is does something in some cases, but it does not what I expect for some simple examples. Please check out the following one:
model foo Real a; Real b; equation a = sin(time); b = 0.3 * a + 0.7 * a; end foo;
If I instantiate model foo without using the flag noSimplify, I get the expected result:
class foo Real a; Real b; equation a = sin(time); b = a; end foo;
But, if I run the same with noSimplify enabled, I still get the same result. I would expect that in that case the expressions should remain as they are written in the model.
Change History (7)
comment:1 by , 10 years ago
comment:2 by , 10 years ago
I think we should have both. noSimplify (really no simplify) and noExpensiveSimplify (no expensive simplify).
comment:3 by , 10 years ago
The problem is most models require simplification in order to generate correct code.
The suggested flags are bad; we support enumeration flags like +simplify=none|simple|full
comment:4 by , 10 years ago
Your proposal sounds good. And we should anyway fix the problems in the Codegen so having +simplify=none would help out with that.
comment:5 by , 10 years ago
No. Codegen should not have to deal with stupid expressions. If you add simplify=none, you should simply expect the code to not compile. There are no ASUB expressions simplified into cref's, for example!
follow-up: 7 comment:6 by , 10 years ago
The Codegen should anyway be able to handle ASUB as not all expressions inside it are crefs.
And I think that's a bug that we generate ASUB for crefs instead of directly crefs.
What I'm saying is that simplify actually hides bugs and that's not very good.
comment:7 by , 10 years ago
I agree, it should be possible to deactivate expression simplifications. I think we should replace noSimplify by an enumeration flag as Martin has proposed.
The flag should be called noExpensiveSimplify, not noSimplify.