Skip to content

Conversation

@jayrm
Copy link
Member

@jayrm jayrm commented Apr 26, 2021

Fixes #298 -Wc has a limit of 128 characters

  • does not directly fix a warning, but allows passing additional arguments to gcc through fbc to control warning generation / suspression

Fixes #217 warning: array subscript -1 is outside array bounds

Fixes gcc warning for esp/rsp in the listing of clobbered registers (now deprecated) by removing esp/rsp from the clobber list.

Fixes really slow compile of tests/compound/select_const.bas by splitting single test procedure in to multiple test procedures

  • due all the constants in one procedure, gcc-9.3 was taking super long time to compile with -O2 and also out of memory errors when trying to compile with debugging symbols

jayrm added 5 commits April 26, 2021 19:15
- prepare for changes to the select const tests causing problems compiling with the gcc backend
- the test will generate a very large C listing (250K+ LOC with debugging enabled) with most of the asserts in a single procedure
- with debug symbols enabled, gcc can run out of memory overflowing the symbol hash tables
- and the test is very taxing on the gcc optimizer (-O1 or higher) resulting in a very slow compile time
- prepare for changes to the select const tests causing problems compiling with the gcc backend
- the test will generate a very large C listing (250K+ LOC with debugging enabled) with most of the asserts in a single procedure
- with debug symbols enabled, gcc can run out of memory overflowing the symbol hash tables
- and the test is very taxing on the gcc optimizer (-O1 or higher) resulting in a very slow compile time
…an 128 characters

- fixes github # 298: -Wc has a limit of 128 characters
- previously fbc used fixed length strings of 128 bytes to hold the options to as, gcc, and ld
- now uses variable length string instead
…higher optimizations

- see github # 217 - warning: array subscript -1 is outside array bounds
- caused by fbc's optimization of non-zero lower bound arrays
- fbc calculates a kind of virtual pointer of where the array(0,..) element would be and then computes element addresses from that
- this optimization in fbc saves some computations when accessing array elements but the translation to C is technically undefined behaviour
- fixed (for now) by casting the address to the equivalent of intptr_t in C.  (FB_DATATYPE_INTEGER).
- it's deprecated in newer gcc versions and silently ignored in older versions
- gcc requires a valid stack to preserve registers and if the asm code clobbers esp/rsp
then there is no way to get it back after esp/rsp changes to something else.
- User is always responsoble for handling the stack registers.
@jayrm jayrm merged commit 180516f into freebasic:master Apr 27, 2021
@jayrm jayrm deleted the gcc-warnings branch April 30, 2021 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Wc has a limit of 128 characters warning: array subscript -1 is outside array bounds

1 participant