tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] '__builtin_frame_address' warning about suspicious us


From: grischka
Subject: Re: [Tinycc-devel] '__builtin_frame_address' warning about suspicious use of this call
Date: Tue, 29 Nov 2016 12:19:43 +0100
User-agent: Thunderbird 2.0.0.23 (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
compiler (tcc).

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.

Thanks,

--- grischka

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

--- a/lib/bcheck.c

+++ b/lib/bcheck.c

@@ -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)

         __bound_delete_region((void *)addr);

     }

}

+#pragma GCC diagnostic pop

 static BoundEntry *__bound_new_page(void)

{




------------------------------------------------------------------------

_______________________________________________
Tinycc-devel mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/tinycc-devel





reply via email to

[Prev in Thread] Current Thread [Next in Thread]