Commit Graph

532 Commits

Author SHA1 Message Date
Sven/Sarah Barth
d3c3b79e79 * don't cast the succeeded node succn to a tcallparanode (it's usually a tloadnode or something similar instead) 2025-01-13 22:23:11 +01:00
Sven/Sarah Barth
1a130056f7 * reformat statement for better readability 2025-01-13 22:22:26 +01:00
florian
c8052a3f1d * cleanup merge artefacts 2025-01-05 11:07:22 +01:00
Sven/Sarah Barth
311c023271 * ensure that any Boolean type can be used for the Succeeded parameter and that there are no unitialized warnings
+ added test
2024-12-13 22:57:25 +01:00
Sven/Sarah Barth
6828da9c6c * fix #41062: correctly handle atomic intrinsics inside generics
+ added test
2024-12-13 22:57:25 +01:00
Sven/Sarah Barth
2390e70a4e * inline nodes can specify whether their result needs to be used 2024-12-12 22:05:15 +01:00
Sven/Sarah Barth
0c52813433 + add support for Delphi-compatible atomic intrinsics 2024-12-12 22:05:15 +01:00
Sven/Sarah Barth
73420dcace * ensure that Default() symbols that use management operators are properly initalized/finalized
+ added test
2024-10-11 18:00:01 +02:00
florian
0735ac0d1f * throw an error in iso/extended pascal mode if enum types are passed to writeln, resolves #40896 2024-08-24 22:14:43 +02:00
J. Gareth "Curious Kit" Moreton
e60a7d01a4 * Inc/Dec nodes converted to Add/Sub now remove
the "nf_modify" flag from the destination so
    constant propagation works more efficiently.
2024-05-05 20:50:37 +00:00
Sven/Sarah Barth
61397d40ae * ensure that Insert() of a single element into a dynamic array is typechecked in a way that the user is notified of errors
+ added test
2024-04-24 23:13:36 +02:00
florian
15398549a4 * fix simplication of max(double,double) with both values being constants 2024-03-26 23:55:47 +01:00
J. Gareth "Curious Kit" Moreton
c79361c010 * Min/max intrinsics now simplify deterministic results 2024-03-26 14:18:31 +00:00
J. Gareth "Curious Kit" Moreton
81b7b80749 * Added support for 64-bit min/max intrinsics 2024-03-26 14:18:31 +00:00
florian
bf2a3566fa * patch by Sergey Larin: Compile dynarr := nil (and, preferably, SetLength(dynarr, 0)) as fpc_dynarray_clear, resolves #40309 2024-03-04 22:44:23 +01:00
florian
4103b3d180 * formatting 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
dba69917a9 * Flags specific to TInlineNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
179fc5848b * Flags specific to TArrayConstructorNode have been moved to their own field 2024-03-02 21:31:21 +01:00
J. Gareth "Curious Kit" Moreton
6597f02ebc * The "Val" intrinsic is now simplified for string constants akin to a
pure function.
2024-01-13 22:24:08 +00:00
J. Gareth "Curious Kit" Moreton
e1f993c363 * tinlinenode.handle_str now uses the new intrinsiccode field for TCallNode 2023-12-17 15:15:36 +00:00
Jonas Maebe
bcf77c70fd default parameter values: fix crash
Fix crash when declaring default parameter values while current_procinfo
is not yet valid

resolves #40413
2023-09-11 21:35:07 +02:00
Jonas Maebe
a9f3906dd5 default(): fix in generics for non-procvars after 1be7416816
Block added in the wrong place :|

Resolves #40409
2023-08-22 21:19:12 +02:00
Jonas Maebe
2476062198 default(): fix webtbf/tw37303 after previous changes 2023-08-21 22:40:24 +02:00
Jonas Maebe
1be7416816 default value: fix issue with inlining
Ensure the mangled name is always the same

Resolves #40404
2023-08-20 22:08:47 +02:00
Jonas Maebe
50040a2cab default values: store as staticvarsyms in staticsymtable
Previously, they were stored as localvarsyms in either the localsymtable
(for procedures/functions) or as localvarsyms in the staticsymtable (for
init/fini code of units/main programs). The latter was a hack (staticsymtables
normally cannot contain localvarsyms) and caused the temp allocator to also
allocate them as a local in fini code even if the default was only in the init
code.

The new approach ensures at most one copy gets allocated per unit, it doesn't
require explicit initialisation (since staticvarsyms are in bss -> zeroed by
default), gets rid of the localvarsyms in staticsymtables, and as a bonus
solves an issue with inconsistent LLVM debug information for the localvarsym
in init/fini code (since the staticsymtable is shared between the init and
fini code, so was the local, and therefore we generated debug info stating
it was defined in the fini code but within the scope of the init code).

Resolves #40395
2023-08-15 21:13:48 +02:00
florian
5670a7543c * properly reset nf_write/nf_modify flags for min/max inline nodes, needed by dead store optimization, resolves #39958
* factored out nutils.node_reset_pass1_write
2022-10-16 22:51:50 +02:00
J. Gareth "Curious Kit" Moreton
798a4d7611 * Fix to bug that would reset nf_write flag on tempref nodes in assignments 2022-08-31 18:25:11 +00:00
Sven/Sarah Barth
8595c927a8 * fix #39876: correctly Read(Str) enum types which have a size smaller than 4 Byte
+ added tests
2022-08-26 17:16:29 +02:00
Sven/Sarah Barth
c122e16beb * fix #39849: it's an error when the file (or string) parameter of a Read*/Write* is followed by a ":"
+ added test
2022-07-29 17:34:55 +02:00
florian
8eb2cea349 * do not throw an internal error if slice is used on dyn. array paramters, resolves #39806 2022-06-23 23:11:18 +02:00
Pierre Muller
5acd7a7b83 Rename tsymtable.insert and delete methods to insertsym ands deletesym 2022-05-03 23:00:28 +02:00
florian
cecb24344c Merge branch 'main' into val_range_check 2022-01-19 22:20:24 +01:00
Sven/Sarah Barth
c59b6a5d8d * High() and Length() for dynamic arrays deal with sizesinttype instead of ossinttype (on AVR the former is 16-bit while the later is 8-bit thus this is an important distinction) 2022-01-18 23:39:31 +01:00
florian
8e4e229a5f + DestSize parameter for fpc_Val_UInt functions 2022-01-11 22:10:26 +01:00
florian
292be9029e * when converting a*a into sqr(a), set the result type correctly
* removefloatupcasts takes care of cs_excessprecision, resolves #39012
2021-11-07 21:54:25 +01:00
Yuriy Sydorov
07dcd22b1c * sizeof(array) and length(array) must return sizeUint in case the array
size does not fit in sizeint. This fixes a range check error during
  compilation on small CPU targets where allowed array size is 64K, but
  sizeint is 32K max.
2021-08-16 21:54:46 +03:00
svenbarth
ca7c775e36 * fix for Mantis #38642: for enumerations with jumps Delphi behaves as follows:
- GetTypeKind returns tkEnumeration (FPC previously generated a compile error here)
  - GetTypeInfo on a generic parameters returns Nil for such types (FPC previously generated a compile error here)
  - GetTypeInfo otherwise generates a compile error (as before)

git-svn-id: trunk@49064 -
2021-03-27 09:35:07 +00:00
Jonas Maebe
3e047d3691 * generate more efficient code for trunc(currency), trunc(comp), and
round(comp) on platforms where currency and comp are handled using the FPU
   o also fixes trunc(comp) and trunc(currency) compilation for x86 on LLVM
     with -Oofastmath
 * add missing removal of excess fpu precision typecasts for trunc/round

git-svn-id: trunk@47854 -
2020-12-27 13:18:47 +00:00
florian
6e4997265c + min/max intrinsics for internal use by the compiler
git-svn-id: trunk@47692 -
2020-12-05 22:00:58 +00:00
florian
28d248c9d4 * cleanup merge overlefts
git-svn-id: trunk@47691 -
2020-12-05 22:00:57 +00:00
florian
bcdfd07bdd * if a variant is read/written, include the variants unit
git-svn-id: trunk@47459 -
2020-11-19 20:53:47 +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
svenbarth
cce2dad1bf * fix for Mantis #37806: allow undefineddefs for Include() and Exclude()
+ added tests

git-svn-id: trunk@46953 -
2020-09-25 14:13:53 +00:00
svenbarth
ff4e1345ff * fix for Mantis #37779: use init RTTI instead of full RTTI when copying an array
+ added test

git-svn-id: trunk@46915 -
2020-09-21 20:17:55 +00:00
svenbarth
d3e18ccb5e * fix for Mantis #37221: apply adjusted patch by Ondrej Pokorny to allow the use of Copy() on open array parameters (the result will be a dynamic array)
+ added test

git-svn-id: trunk@46890 -
2020-09-18 15:00:10 +00:00
florian
60bd9c5ba0 * write a proper error message if types are read/written which are not supported in iso mode, resolves #37763
git-svn-id: trunk@46885 -
2020-09-17 19:58:55 +00:00
svenbarth
8770af84bd * fix for Mantis #37187: inside generics the constant code in pexpr does not handle all cases and thus current_procinfo needs to be checked as well
+ added test

git-svn-id: trunk@46218 -
2020-08-03 21:53:14 +00:00
florian
f542ee7b92 * do not throw an internal error if an errorneous type is passed to str, resolves #37462
git-svn-id: trunk@45983 -
2020-08-01 21:11:35 +00:00
florian
18877dc96e * check if current_procinfo is assigned when creating a default sym to avoid a crash, resolves #37303
git-svn-id: trunk@45772 -
2020-07-11 20:30:33 +00:00
svenbarth
d401639b24 * fix for Mantis #37251: apply patches by Bi0T1N to implement the IsConstValue() intrinsic
+ added tests

git-svn-id: trunk@45695 -
2020-06-25 20:42:47 +00:00