bfgroup / b2

B2 makes it easy to build C++ projects, everywhere.
https://www.bfgroup.xyz/b2/
Boost Software License 1.0
75 stars 228 forks source link

Warnings about freeing a non-allocated object #366

Open Lastique opened 5 months ago

Lastique commented 5 months ago

Make sure you completed the following tasks

Environment and version details

Brief problem description

I'm not sure if this is a genuine problem, but when building b2 with debug information gcc emits a warning that free is being called on a non-allocated object.

Steps to reproduce the issue

$ ./build.sh --debug

###
###
### Using 'gcc' toolset.
###
###

g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

###
###

> g++ -x c++ -std=c++11 -pthread -O0 -g bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp tasks.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_summary.cpp mod_sysinfo.cpp mod_version.cpp -o b2
src/engine/jamgram.cpp: In function ‘int yyparse()’:
src/engine/jamgram.cpp:2282:18: warning: ‘void free(void*)’ called on unallocated object ‘yyssa’ [-Wfree-nonheap-object]
src/engine/jamgram.cpp:1152:16: note: declared here

Expected behavior summary

This warning is alarming. If this is a false positive then please silence it to avoid confusion. Otherwise, if this is a genuine bug, then please fix it.