--- Merging r34035 into '.':

U    compiler/nadd.pas
A    tests/tbs/tb0621.pp
--- Recording mergeinfo for merge of r34035 into '.':

git-svn-id: branches/fixes_3_0@34068 -
This commit is contained in:
Jonas Maebe 2016-07-05 16:30:43 +00:00
parent 2d99a173eb
commit 3da9f31fa2
3 changed files with 34 additions and 2 deletions

1
.gitattributes vendored
View File

@ -10616,6 +10616,7 @@ tests/tbs/tb0606.pp svneol=native#text/pascal
tests/tbs/tb0607.pp svneol=native#text/plain
tests/tbs/tb0608.pp svneol=native#text/pascal
tests/tbs/tb0609.pp svneol=native#text/plain
tests/tbs/tb0621.pp svneol=native#text/plain
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tb610.pp svneol=native#text/pascal
tests/tbs/tb613.pp svneol=native#text/plain

View File

@ -697,8 +697,12 @@ implementation
an slash expresion would be first converted into a multiplication and later
folded }
if (nodetype=slashn) and
{ do not mess with currency types }
(not(is_currency(right.resultdef))) and
{ do not mess with currency and comp types }
(not(is_currency(right.resultdef)) and
not((right.resultdef.typ=floatdef) and
(tfloatdef(right.resultdef).floattype=s64comp)
)
) and
(((cs_opt_fastmath in current_settings.optimizerswitches) and (rt=ordconstn)) or
((cs_opt_fastmath in current_settings.optimizerswitches) and (rt=realconstn) and
(bestrealrec(trealconstnode(right).value_real).SpecialType in [fsPositive,fsNegative])

27
tests/tbs/tb0621.pp Normal file
View File

@ -0,0 +1,27 @@
PROGRAM compbug300;
VAR x1, x2 : comp;
(* Dividing 8 / 2 doesn't work with fpc 3.0.0
but works for example with fpc 2.6.4
Markus Greim / 29.jun.2016 *)
BEGIN
x1 := 8;
writeln('x1 : ',x1);
x2 := x1 / 2;
writeln('x2 = x1/2 should be 4 but is : ', x2);
if x2<>4 then
halt(1);
x2 := x1 / 4;
writeln('x2 = x1/4 should be 2 but is : ', x2);
if x2<>2 then
halt(2);
x2 := x1 / 8.0;
writeln('x2 = x1/8.0 should be 1 and is : ', x2);
if x2<>1 then
halt(3);
END.