[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] '__builtin_frame_address' warning about suspicious us
Re: [Tinycc-devel] '__builtin_frame_address' warning about suspicious use of this call
Tue, 29 Nov 2016 12:19:43 +0100
Thunderbird 18.104.22.168 (Windows/20090812)
Christian Jullien wrote:
GCC documentation says:
Calling this function with a nonzero argument can have unpredictable
effects, including crashing the calling program. As a result, calls that are
considered unsafe are diagnosed when the -Wframe-address option is in
effect. Such calls should only be made in debugging situations.
^^^^^ This latest sentence makes me afraid!
Actually we are in a "debugging situation" with bcheck.c which
is helper code for the tcc -b switch.
Also, in our case the result is not unpredictable because these
functions are used in a controlled way by calls inserted by the
If you use
#pragma GCC diagnostic ignored "-Wframe-address"
it will probably just trigger another warning
xxx.c:00: warning: ignoring #pragma GCC diagnostic
with most versions of gcc.
Alternatively we could just use tcc to compile the library
which you get by commenting out the lines
XCC = $(CC)
near the top of lib/Makefile for i386/x86_84.
Feel free to make such change to mob, if it works.
Two questions here:
Q1. Should we really call this function with one arg?
Q2. If safe, we should make this change to avoid this warning:
diff --git a/lib/bcheck.c b/lib/bcheck.c
index 756c539..8a75654 100644
@@ -240,6 +240,9 @@ BOUND_PTR_INDIR(16)
fp = (size_t)__builtin_frame_address(1);\
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wframe-address"
/* called when entering a function to add all the local regions */
void FASTCALL __bound_local_new(void *p1)
@@ -273,6 +276,7 @@ void FASTCALL __bound_local_delete(void *p1)
+#pragma GCC diagnostic pop
static BoundEntry *__bound_new_page(void)
Tinycc-devel mailing list