Skip to content

Commit

Permalink
Merge pull request #1243 from CEED/jed/fix-asan-bugs
Browse files Browse the repository at this point in the history
Fix -fsanitize=address bugs
  • Loading branch information
jedbrown authored Jun 30, 2023
2 parents 62e4d60 + fb65186 commit 7bd8c1e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/c-fortran-test-linux-osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
matrix:
os: [ubuntu-22.04, macos-12]
compiler: [gcc-11, clang]
include:
- os: ubuntu-22.04
asan: 1

runs-on: ${{ matrix.os }}

Expand All @@ -22,6 +25,8 @@ jobs:
env:
CC: ${{ matrix.compiler }}
FC: gfortran-11
AFLAGS: -fsanitize=address -fsanitize=leak
ASAN: ${{ matrix.asan }}
run: |
make -v
make info
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ endif

# Warning: SANTIZ options still don't run with /gpu/occa
# export LSAN_OPTIONS=suppressions=.asanignore
AFLAGS = -fsanitize=address #-fsanitize=undefined -fno-omit-frame-pointer
AFLAGS ?= -fsanitize=address #-fsanitize=undefined -fno-omit-frame-pointer

# Note: Intel oneAPI C/C++ compiler is now icx/icpx
CC_VENDOR := $(subst icc_orig,icc,$(firstword $(filter gcc clang icc icc_orig oneAPI XL emcc,$(subst -, ,$(shell $(CC) --version)))))
Expand Down
4 changes: 2 additions & 2 deletions backends/memcheck/ceed-memcheck-qfunction.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ static int CeedQFunctionApply_Memcheck(CeedQFunction qf, CeedInt Q, CeedVector *
int mem_block_ids[num_out];
for (CeedInt i = 0; i < num_out; i++) {
CeedSize len;
char name[30] = "";
char name[32] = "";

CeedCallBackend(CeedVectorGetArrayWrite(V[i], CEED_MEM_HOST, &impl->outputs[i]));

CeedCallBackend(CeedVectorGetLength(V[i], &len));
VALGRIND_MAKE_MEM_UNDEFINED(impl->outputs[i], len);

snprintf(name, 30, "'QFunction output %" CeedInt_FMT "'", i);
snprintf(name, 32, "'QFunction output %" CeedInt_FMT "'", i);
mem_block_ids[i] = VALGRIND_CREATE_BLOCK(impl->outputs[i], len, name);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/t568-operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ int main(int argc, char **argv) {
CeedQFunctionAddOutput(qf_setup, "qdata", dim * (dim + 1) / 2, CEED_EVAL_NONE);

CeedQFunctionCreateInterior(ceed, 1, diff, diff_loc, &qf_diff);
CeedQFunctionAddInput(qf_diff, "qdata", dim * (dim + 1) / 2, CEED_EVAL_NONE);
CeedQFunctionAddInput(qf_diff, "du", num_comp * dim, CEED_EVAL_GRAD);
CeedQFunctionAddInput(qf_diff, "qdata", dim * (dim + 1) / 2, CEED_EVAL_NONE);
CeedQFunctionAddInput(qf_diff, "dummy u", num_comp, CEED_EVAL_INTERP);
CeedQFunctionAddOutput(qf_diff, "dv", num_comp * dim, CEED_EVAL_GRAD);

Expand Down

0 comments on commit 7bd8c1e

Please sign in to comment.