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

compile error (using clang with asan) #20

Closed
frokaikan opened this issue Jul 9, 2018 · 3 comments
Closed

compile error (using clang with asan) #20

frokaikan opened this issue Jul 9, 2018 · 3 comments

Comments

@frokaikan
Copy link

I use clang(with fsanitize=address) to compile this project.
when I call $ make
I receive:

awk -v l=/opt/SmallerC/v0100/srclib/ '/.$/{$0=l$0}{print}' /opt/SmallerC/v0100/srclib/lcds.txt > lcds.op
./smlrcc -SI /opt/SmallerC/v0100/include -I /opt/SmallerC/v0100/srclib @lcds.op

==15851==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1400 byte(s) in 1 object(s) allocated from:
#0 0x4da2e0 in realloc (/opt/SmallerC/smlrcc+0x4da2e0)
#1 0x51445b in fatargs /opt/SmallerC/v0100/smlrcc.c:550:23

SUMMARY: AddressSanitizer: 1400 byte(s) leaked in 1 allocation(s).
/opt/SmallerC/v0100/../common.mk:42: recipe for target 'lcds.a' failed
make: *** [lcds.a] Error 1
rm lcds.op

@frokaikan frokaikan changed the title compile error (using clang) compile error (using clang with asan) Jul 9, 2018
@alexfru
Copy link
Owner

alexfru commented Jul 9, 2018

smlrcc, smlrl, n2f may do a few allocations which aren't freed before termination.
This isn't critical to operation of these programs as they aren't doing lots of allocations and deallocations that would potentially cause out of memory errors (due to depletion of free memory or address space fragmentation). And these programs do not operate continuously.
My simple recommendation is to not use ASAN. It's unlikely to find any problem worthy of attention. The compiler proper, smlrc, does not allocate memory dynamically as of now.

@alexfru
Copy link
Owner

alexfru commented Jul 11, 2018

@frokaikan Any progress?

@frokaikan
Copy link
Author

Ah, I let asan not detect the memory leak and now I could compile it.
Thanks.

@alexfru alexfru closed this as completed Jul 12, 2018
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

No branches or pull requests

2 participants