Related: byref function result chained with additional methods The byref result is passed as an instance parameter to the next method call; under the hood, methods have method(this, args) as parameters, so at the very least we should expect arguments to the method to be evaluated before the method call. However, as can see in this example, all arguments are evaluated before any method call which is surely incorrect. type Q x as single declare function d( byval arg as single ) as single declare function...
The calling convention (stdcall, pascal, cdecl) imposes the order of passing the parameters (in the stack) relative to the order in which they are listed in the declaration, but nothing specifically imposes that the corresponding arguments are evaluated (for passing by value) in the same order. Otherwise, I think gas(32) is right, and it is not because the arguments provided are references that they should not still be passed by value as stipulated in the declaration.
Different behavior of gas and gcc/gas64 on a same unsafe code, but is it a bug?
Merge remote-tracking branch 'jayrm/fbc-1.10' into master
fbc: PEEK, POKE, and SWAP name resolution
profiler: rtlib: fix gcc warnings
profiler: rtlib: allow compile on older gcc
docs: add -earraydims to man page
Merge remote-tracking branch 'origin/fbc-1.10' into master
contrib/release/build.sh: remove downloaded package
release: build-bsd.sh
release: update manifests for fbc 1.10.3
release: build.sh using recipe names
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp chaos_wave retval, neg10_to_positiv10 using set( .. as ulongint, .. ), chaos_wave output was like -------\/\/\/\
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp chaos_wave retval, neg10_to_positiv10 output -------\/\/\/\
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp call chaos_wave ret, neg10_to_positiv10 output -------\/\/\/\
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp call chaos_wave ret, neg10_to_positiv10 the output was -------\/\/\/\
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp call chaos_wave ret, neg10_to_positiv10 the output was -------\/\/\/\
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp call chaos_wave ret, neg10_to_positiv10
perhaps i will join gcc forum. anyway, this was my use case '' custom rng initialize sub set( _a as longint = 1, _b as longint = 0 ) '' changed to longint after i id'd culprit a = _a: b = _b '' rng-based waveform sub chaos_wave( byref f as double, i as double ) rng.set int(i) '' seed f = rnd rng.set int(i) + 1 '' seed-in-sequence f = f + (i - int(i)) * (rnd - f) '' linear interp
fbc: clean-up whitespace
fbc: github # 426: add __FB_ARG_LISTEXPAND__( macroname, macroargcount, args... )
Merge pull request #426 from skyfish4tb/master
Preprocess the target macro based on the macro parameter list.
rtlib/dos: write NUL character when DISABLE_WCHAR is used
release: revert to libffi 3.3 for some versions of windows builds
makefile: add bootstrap-dist-target
release: use recipes to select arm bootstrap package and options
makefile: add FBPACKTARGET
changelog.txt: fix formatting of 1.10.2 section
makefile: ensure that libdir is created
makefile: sanitize whitespace
I would guess that the direct conversion from float to unsigned should work correctly for positive floats to unsigned integer where number ranges are valid. If you are expecting conversion from a single '-1' to be the max value of a ULONGINT, try converting to LONGINT first. for x as single = -1 to 0 print culngint(clngint(x - 1)) next This should force handling x as a single and doing the conversion at run-time - mainly because fbc will insert asm code, preventing gcc from optimizing it away. For...
bringing to attention .. regular fbc i see no error
gcc -Wc -Ofast ulongint from negative float
array bounds weird in funcs
Dimension count check added in fbc 1.20.0. New command line option '-earraydims' generates error checking code for dimensions. Closing this ticket. Follow [#721] for examples and more information
Changed in fbc 1.20.0 added -earraydims command line option, implied by -exx command line option will add checking for unallocated arrays and wrong number of dimensions. Update error messages. Example #1 - out of bounds array access (updated error message) sub proc( array() as integer ) array(99) = 0 end sub redim X(0 to 3) as integer proc( X() ) $ fbc example.bas -earray $ example Aborting due to runtime error 6 (out of bounds array access) at line 2 of example.bas(), 'ARRAY' accessed with invalid...
I think the current behaviour should be changed. It would be nice if len(array) and sizeof(array) would return length and size of an array if the result is known to be constant at compile time. However, that might be confusing for users if the behaviour changes from fbc version to the next. So perhaps disabling it completely for a release and then bringing it back later is a reasonable method to implement a behaviour change.
rtlib/dos: update symb_reg.txt
Merge remote-tracking branch 'jayrm/array-bounds' into master
fbc: add '-earraydims' for error checking on array dimensions and unallocated arrays
Merge remote-tracking branch 'jayrm/fb-profiler' into master
profiler: rtlib: update counts and times
profiler: clean-up code to date
This works, but if and only if index is zero and pointer to the array data is zero. @array(lbound(array)) = NULL @array(index) is essentially cast(typeof(array) ptr, array->data + index * sizeof(typeof(array))) I will guess it was done this way originally since it is a fast way to determine if the array is empty without any extra conditional checks or function calls. My opinion is that it works for a specific usage but is unsuitable for other common usages, like taking the address of an array element...
Merge remote-tracking branch 'jayrm/fb-profiler' into master
profiler: gas64: fix fb_profilecycledata alignment of 16
rtlib: profiler: split profile.c
profiler: prepare to split profile.c
profiler: rtlib: track procedure entry and exit
profiler: rtlib: profiler instance on every thread
gas64: profiler: group profile data sections in the the ASM listing
Merge remote-tracking branch 'jayrm/newboundcheck' into master
rtlib: Array out of bounds index check
fbc : new bounds check error message (variable name + index + bounds)
Merge remote-tracking branch 'jayrm/fbdocs' into master
fbdocs: wiki snapshot 2024.05.12 - update examples/manual
fbdocs: wiki snapshot 2024.04.28
fbdocs: wiki snapshot 2024.05.12
LEN() and SIZEOF() should not be allowed when used with an array name without index
Merge remote-tracking branch 'jayrm/fb-profiler' into master
profiler: rtlib: default filename
profiler: fbc: fix __FB_PROFILE__ return value
gas64: profiler: add attributes to section names
profiler: rtlib: fix compilation warnings
gas64: profiler: reorganize implementation (wip)
profile : reduced size for sections and dumps
profile : WIP 2 for multi modules
profile : WIP for multi modules
fbc : profiling mostly with gas64 (WIP)
Merge remote-tracking branch 'jayrm/fb-profiler' into master
profiler: fbc: don't profile THISCALL and FASTCALL calling convention procedures
profiler: refactor and add features
profiler: rtlib: add fb_ProfileLock()/fb_ProfileUnlock()
profiler: rtlib: update changelog.txt
profiler: Add API to set profiler options
fbc-int: declare rtlib lock/unlock procs to inc/fbc-int/system.bi
profiler: rtlib: early out finding self in find_all_procs()
fbc: ir: fix number of args in irEmitPUSH() and itEmitPOP()
profiler: rtlib: store the hash value of procedure names
profiler: rtlib: fix initialization
profiler: rtlib: add dynamic string table to store procedure names
profiler: rtlib: add call count to profile.txt report
profiler: rtlib: refactor column alignment pad_spaces()
profiler: rtlib: add a BIN id (for debugging)
profiler: rtlib: cosmetic code clean-up
profiler: rtlib: rewrite to allow compilation
profiler: rtlib add original rtlib/profile.c
profiler: #pragma profile, __FB_PROFILE__, __FB_OPTION_PROFILE__
profiler: fbc: add compiler side support
profiler: fbc: add command line options and internal options
profiler: rtlib: add fbrt1 profiler startup module
fbc-tests: remove debugging print statement
Initialize variables
Merge pull request #425 from zamabuvaraeu/patch-2
Initialize variables
Initialize variables
Initialize variables
Initialize variables