tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] [PATCH] forbid invalid comparison of struct


From: Hitoshi Mitake
Subject: Re: [Tinycc-devel] [PATCH] forbid invalid comparison of struct
Date: Mon, 5 Nov 2012 21:37:34 +0900

On Mon, Nov 5, 2012 at 12:33 AM, Hitoshi Mitake <address@hidden> wrote:
> Hi tcc folks, nice to meet you.
>
> I found a trivial bug of tcc. Current tcc permits comparison of
> structs and comparison between struct and other typed values. This
> patch can fix the bug.
>
> I'm new to tcc. Sorry if this patch contains wrong part.
> I'd like to hear your comments.

Sorry, I fixed the bug of old version. I'll send an updated patch for
the latest mod branch later.

>
> Thanks,
>
> ---
>  tccgen.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/tccgen.c b/tccgen.c
> index 942c503..ab4eee2 100644
> --- a/tccgen.c
> +++ b/tccgen.c
> @@ -1350,6 +1350,8 @@ void gen_op(int op)
>              (t2 & (VT_BTYPE | VT_UNSIGNED)) == (VT_LLONG | VT_UNSIGNED))
>              t |= VT_UNSIGNED;
>          goto std_op;
> +    } else if (bt1 == VT_STRUCT || bt2 == VT_STRUCT) {
> +       error("comparison of struct");
>      } else {
>          /* integer operations */
>          t = VT_INT;
> --
> 1.7.5.1
>



--
Hitoshi Mitake
address@hidden



reply via email to

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