Skip to content

Commit

Permalink
lto warning fix (#5766)
Browse files Browse the repository at this point in the history
* attempt to resolve lto compilation warning #5760

* do not allow failure anymore

* another attempt for lto warning

* try to fix another lto warning

* move comment to related line, thx Michael
  • Loading branch information
jangorecki authored Nov 27, 2023
1 parent 50a3dc3 commit a6fe882
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,12 @@ build:

## most comprehensive tests
# force all suggests
# flags: gcc -O3 -flto -fno-common -Wunused-result
# flags: gcc -O3 -flto=auto -fno-common -Wunused-result
# tests for compilation warnings
test-rel-lin:
<<: *test-lin
image: registry.gitlab.com/jangorecki/dockerfiles/r-data.table
needs: ["mirror-packages","build"]
allow_failure: true ## temp workaround #5760
variables:
_R_CHECK_CRAN_INCOMING_: "FALSE"
_R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE"
Expand All @@ -148,8 +147,8 @@ test-rel-lin:
- *cp-src
- rm -r bus
- mkdir -p ~/.R
- echo 'CFLAGS=-g -O3 -flto -fno-common -Wunused-result -fopenmp -Wall -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' > ~/.R/Makevars
- echo 'CXXFLAGS=-g -O3 -flto -fno-common -Wunused-result -fopenmp -Wall -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' >> ~/.R/Makevars
- echo 'CFLAGS=-g -O3 -flto=auto -fno-common -Wunused-result -fopenmp -Wall -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' > ~/.R/Makevars
- echo 'CXXFLAGS=-g -O3 -flto=auto -fno-common -Wunused-result -fopenmp -Wall -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' >> ~/.R/Makevars
script:
- *mv-src
- cd bus/$CI_JOB_NAME
Expand Down
3 changes: 2 additions & 1 deletion src/chmatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ static SEXP chmatchMain(SEXP x, SEXP table, int nomatch, bool chin, bool chmatch
// For example: A,B,C,B,D,E,A,A => A(TL=1),B(2),C(3),D(4),E(5) => dupMap 1 2 3 5 6 | 8 7 4
// dupLink 7 8 | 6 (blank=0)
int *counts = (int *)calloc(nuniq, sizeof(int));
int *map = (int *)calloc(tablelen+nuniq, sizeof(int)); // +nuniq to store a 0 at the end of each group
unsigned int mapsize = tablelen+nuniq; // lto compilation warning #5760 // +nuniq to store a 0 at the end of each group
int *map = (int *)calloc(mapsize, sizeof(int));
if (!counts || !map) {
// # nocov start
for (int i=0; i<tablelen; i++) SET_TRUELENGTH(td[i], 0);
Expand Down

0 comments on commit a6fe882

Please sign in to comment.