Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Precedence Problem

Intel_C_Intel
Employee
333 Views
I'm using CVF 6.6C - I know what the problem is, and I know how to fix it. I just don't get how the compiler parses the following:



y(1) = mol_out * stream(flue_gas).multi_air.oxygen
y(2) = mol_out * stream(flue_gas).multi_air.CO2
y(3) = mol_out * stream(flue_gas).multi_air.SO2
y(4) = mol_out * stream(flue_gas).multi_air.NO2
y(5) = mol_out * stream(flue_gas).multi_air.HC_STEAM / 2.
y(6) = ash_flow * stream(clinker).fuelgas.oxygen / MW_O2
y(7) = ash_flow * stream(clinker).fuelgas.moisture / MW_H2O / 2.
y(8) = mol_CaSO4 * 2. ! needs O2 for SO3 => SO4
y(9) = mol_CaO / 2. ! overdoses on CaO

O2_out_bits = y(1) + y(2) + y(3) + y(4) + y(5) + y(6) + y(7) + y(8) + y(9)

O2_out = mol_out * stream(flue_gas).multi_air.oxygen
1 + mol_out * stream(flue_gas).multi_air.CO2
2 + mol_out * stream(flue_gas).multi_air.SO2
3 + mol_out * stream(flue_gas).multi_air.NO2
4 + mol_out * stream(flue_gas).multi_air.HC_STEAM / 2.
5 + ash_flow * stream(clinker).fuelgas.oxygen / MW_O2
6 + ash_flow * stream(clinker).fuelgas.moisture / MW_H2O / 2.
7 + mol_CaSO4 * 2. ! needs O2 for SO3 => SO4
8 + mol_CaO / 2. ! overdoses on CaO




O2_out_bits is correct, O2_out is not. How does the precedence parsing screw up the second example? (i.e., where are the implied parentheses?)
0 Kudos
3 Replies
Steven_L_Intel1
Employee
333 Views
Replace the dot field separators with %. Does it get it right now? We've had problems with this over the years, and some errors were discovered after CVF development ceased. (Intel Fortran has fixed them.)
0 Kudos
Intel_C_Intel
Employee
333 Views
Thanks Steve - I remember reading about that problem on here!
Incidently, is it due to the use of 2. instead of 2.D0?
0 Kudos
Steven_L_Intel1
Employee
333 Views
No. It's specifically due to using dot record field separators. The parser has complex rules for deciding whether this syntax is a field or an operator and sometimes it makes up its mind "too late" and messes up the precedence of other operators. We think that we have nailed all of these down in the current Intel compiler.
0 Kudos
Reply