Commit Graph

536 Commits

Author SHA1 Message Date
florian
29a5d3267c * moved warning about suspicious comp assignment to type check pass, catches also
assignments of constants

git-svn-id: trunk@49242 -
2021-04-21 19:51:22 +00:00
florian
71dc62dde6 * if left is a smaller type, then an extension operation for shr can be removed
git-svn-id: trunk@49231 -
2021-04-18 19:19:35 +00:00
florian
09628e56cb * even if currency is handled by torddef, it is a real number, so using / is perfectly right, resolves #38718
git-svn-id: trunk@49154 -
2021-04-09 20:38:46 +00:00
florian
ecce39a3b2 + throw a warning in ISO mode if a constant string is assigned to a char and the sizes do not match, resolves #38439
git-svn-id: trunk@48563 -
2021-02-09 20:48:27 +00:00
florian
344aadebb9 * avoid widening of shl operations, this is not necessary for them either
git-svn-id: trunk@48150 -
2021-01-12 21:45:38 +00:00
florian
9858d9c5e6 * apply doremoveinttypeconvs to unary minus and not on 8 and 16 bit targets as well
git-svn-id: trunk@47796 -
2020-12-16 21:55:05 +00:00
florian
d5dcf5cd7a * cleanup
git-svn-id: trunk@47522 -
2020-11-21 21:58:30 +00:00
florian
ea11517d27 + optimization type converted (modulo) divisions as well by removing up/down converting but,
insert a test and separate code path for -1 if needed

git-svn-id: trunk@47521 -
2020-11-21 21:58:28 +00:00
florian
6380df9b42 * correctly simplify tree transforms of (a+c1+c2) if a is a pointer, resolves #37671
git-svn-id: trunk@47437 -
2020-11-16 21:47:19 +00:00
florian
dc547b1426 + remove type conversions also for unary operations if possible
git-svn-id: trunk@47155 -
2020-10-22 21:25:37 +00:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
Jonas Maebe
9f42931eeb * don't print range check warnings when evaluating inlined explicit typecasts
git-svn-id: trunk@46904 -
2020-09-20 10:29:51 +00:00
svenbarth
2c372071fd * correctly handle static arrays with a lower index <> 0
+ added test

git-svn-id: trunk@46901 -
2020-09-19 21:20:07 +00:00
svenbarth
bf1eae7bd6 * small formatting adjustments for the sake of consistency
git-svn-id: trunk@46892 -
2020-09-18 15:00:17 +00:00
svenbarth
2ff18e48a0 * fix for Mantis #36909: apply patch by Ryan Joseph so that array constructors can be used for static arrays as well.
+ added test

git-svn-id: trunk@46891 -
2020-09-18 15:00:15 +00:00
pierre
57b8f28574 Avoid overflow errors on z80 CPU by changing local variable type from aint to tcgint
git-svn-id: trunk@45816 -
2020-07-21 05:23:36 +00:00
svenbarth
eaa2a2006c * fix for Mantis #37272: also allow the empty set for dynamic array parameters; Delphi probably started to allow that together with array constructors.
+ added tests

git-svn-id: trunk@45706 -
2020-06-27 22:33:31 +00:00
Jonas Maebe
5be84e8079 * replaced custom packed record with tmethod
git-svn-id: trunk@45465 -
2020-05-22 13:11:52 +00:00
florian
b6097a0300 * correctly handle result type of string constant nodes for internally created
nodes

git-svn-id: trunk@45231 -
2020-05-03 12:41:17 +00:00
Jonas Maebe
f5e89ded35 * fix tc_bool_2_int simplification in case pass typecheck runs again, e.g.
after getting a copy of the node during CSE (fixes taddset4 compilation
    with LLVM after r44712)

git-svn-id: trunk@45087 -
2020-04-26 11:36:42 +00:00
svenbarth
60345366f2 * fix for Mantis #35140: apply patch by Ryan Joseph together with some further changes by me to add support for constant parameters in generics
+ added tests

git-svn-id: trunk@45080 -
2020-04-25 22:12:35 +00:00
florian
4d73a9e637 * simplify tc_bool_2_int
git-svn-id: trunk@44712 -
2020-04-12 20:50:39 +00:00
florian
04f3784af5 * better setting of expectloc
git-svn-id: trunk@44619 -
2020-04-06 20:44:31 +00:00
Jonas Maebe
afd0ae44ee * use tprocvardef.getreusableprocaddr also for non-address-only copies of
proc(var)defs

git-svn-id: trunk@44517 -
2020-04-02 21:21:40 +00:00
pierre
9c067709f8 Fix invalid typecast revealed by -CriotR option
git-svn-id: trunk@44108 -
2020-02-03 22:35:25 +00:00
florian
91696d2cf3 - remote accidently committed printnode call
git-svn-id: trunk@44099 -
2020-02-02 19:17:22 +00:00
florian
53d2df07b6 * mark handled currencies correctly, so they are handled properly by simplify
git-svn-id: trunk@44098 -
2020-02-02 18:28:42 +00:00
florian
6a1c09bb43 * simplify type conversions of ordinal constants to currency
git-svn-id: trunk@44055 -
2020-01-28 21:19:05 +00:00
Jonas Maebe
67dbd0cdb3 * support nf_internal to ignore currency conversion adjustments also on
platforms that implement currency using a floating point type

git-svn-id: trunk@43817 -
2019-12-30 15:05:02 +00:00
florian
86d8e79e86 * fix some currency issues, resolves #33963 and #36179
git-svn-id: trunk@43620 -
2019-12-01 20:24:00 +00:00
Jonas Maebe
5800ac6213 * fix conversion from Objective-C class/protocol to tvarrec (store in
vPointer) (mantis #36362)

git-svn-id: trunk@43594 -
2019-11-26 21:24:56 +00:00
svenbarth
0a915e883e * keep track of static symbols that a global function references, as those must now be exported from a dynamic package as well if the function can potentially be inlined
git-svn-id: trunk@43544 -
2019-11-21 21:44:53 +00:00
Jonas Maebe
d23c7980aa * properly perform (or not) range/overflow checking when performing constant
propagation into inlined routines, regardless of the range/overflow
    checking state at the caller site

git-svn-id: trunk@43436 -
2019-11-10 12:00:05 +00:00
Jonas Maebe
ac1e0f96bd * replaced tentryfile.get/putsmall/normalset() with a common tget/putset
that expects an open array of byte, and use it for all sets
   o since all sets need to be typecasted to an array type of the appropriate
     size, we'll get a compilation error in case this needs to be done and
     that also tells us at the same time that the ppu version will need to
     be increased
  * enabled {$packset 1} for the compiler, as this is now safe with the above
    changes

git-svn-id: trunk@43407 -
2019-11-06 21:50:19 +00:00
florian
e19eff1332 * also type casts to booleans benefit if unneeded type widenings are removed
git-svn-id: trunk@43344 -
2019-11-01 09:52:37 +00:00
svenbarth
663040a666 * ensure that aprocdef is initialized to Nil to catch problems with compare_defs_ext() easier
git-svn-id: trunk@42699 -
2019-08-15 14:32:57 +00:00
Jonas Maebe
c038e4c3f2 * relaxation of r42272: again only show warnings rather than errors for
out-of-range constants, because of the comments mentioned in #35753
    (except for enums, as apparently Delphi does the same)
  * added range check warnings about explicit type casts that throw away
    bits (e.g. byte($fff)), without giving warnings for most common cases
    (like cardinal(-1))
  * fixed masking/sign exting constant array indices (must be based on index
    range type size/signedness rather than on array size/"signedness")

git-svn-id: trunk@42275 -
2019-06-23 14:12:33 +00:00
pierre
243c967967 Commit of new debug feature implemented by J. Gareth Moreton
Allows compilation of compiler using -dDEBUG_NODE_XML
  which will generate a NAME-node-dump.xml file for each 
  unit, program or library compiled,
  containing a XML description of the nodes handled during
  compilation of the unit, program or library.

git-svn-id: trunk@42271 -
2019-06-22 14:08:47 +00:00
florian
749c4d4e47 + keep (certain) arrays in registers if they are used with constants indices only
git-svn-id: trunk@42239 -
2019-06-16 21:29:48 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
svenbarth
18519c9559 * fix for Mantis #34526: rely on tc_arrayconstructor_2_set instead of manually converting an array constructor to a set, this way assignment operator overloads are taken into account as well
Note: there is still a conversion to a set if the types were determined to be incompatible, so that the error is still "set of X is incompatible to Y" instead of "array of Z is incompatible to Y"
+ added tests

git-svn-id: trunk@41844 -
2019-04-05 15:24:39 +00:00
svenbarth
156b25501d * improve conversion of array constructor to set so that it behaves as if done inside pass_typecheck
git-svn-id: trunk@41843 -
2019-04-05 15:24:36 +00:00
yury
e5c2d13671 * Do not set pi_needs_got in current_procinfo.flags at the node level, since the GOT usage can only be estimated there. Instead set the pi_needs_got flag at places where the GOT register is accessed during the code generation. This eliminates generation of the unneeded initialization of the GOT register and fixes linker errors when the _GLOBAL_OFFSET_TABLE_ symbol is referenced but no actual GOT references are present.
git-svn-id: trunk@41460 -
2019-02-25 13:35:40 +00:00
Jonas Maebe
acf02ab64b * when creating wrappers, add a prefix to parameter names to prevent them
hiding the method name of the wrapped routine
   o also add a few more '&' prefixes to the generated wrapper code to
     prevent issues when keywords are used as identifiers

git-svn-id: trunk@40634 -
2018-12-24 22:10:06 +00:00
Jonas Maebe
dd29088430 * simplify all type conversions for formal constants even for LLVM and JVM
(since these happen at compile time and don't result in generated code,
     they never need extra type conversions in the code)

git-svn-id: trunk@40629 -
2018-12-24 22:09:48 +00:00
Jonas Maebe
2c7c0d1144 * handle widechar constants directly in the scanner, instead of in the
overload selection (where you can't even know whether the string is
    a valid widechar constant) (mantis #33875)

git-svn-id: trunk@40009 -
2018-10-21 17:34:00 +00:00
Jonas Maebe
0b246f3dbd * converted Boolean8 to an internal type, and mapped Boolean to the
new internal pasbool1(type) (part of mantis #34411)
   o apply the _Bool x86-64 parameter passing rules only to pasbool1

git-svn-id: trunk@39949 -
2018-10-16 21:14:18 +00:00
florian
68eb921d46 * broken compilation after r39347 fixed
git-svn-id: trunk@39349 -
2018-06-30 12:30:25 +00:00
Jonas Maebe
8da8b956b0 * discard type conversions from/to generic defs for llvm as well
git-svn-id: trunk@38864 -
2018-04-28 16:17:45 +00:00
Jonas Maebe
eaafb166ad * set totypedef correctly when converting @class.classmethod to a procvar
of object in FPC mode (for llvm)

git-svn-id: trunk@38863 -
2018-04-28 16:17:41 +00:00