Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix -fsanitize=address bugs #1243

Merged
merged 2 commits into from
Jun 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
jedbrown marked this conversation as resolved.
Show resolved Hide resolved
CeedQFunctionAddOutput(qf_diff, "dv", num_comp * dim, CEED_EVAL_GRAD);

Expand Down