tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] Small patch


From: Domingo Alvarez Duarte
Subject: Re: [Tinycc-devel] Small patch
Date: Thu, 31 Jan 2013 01:13:30 +0000

Also on this function:

CID 968150 (#1 of 1): Unchecked return value (CHECKED_RETURN)6. check_return: Calling function "parse_btype(CType *, AttributeDef *)" without checking return value (as is done elsewhere 7 out of 8 times).


/* enum/struct/union declaration. u is either VT_ENUM or VT_STRUCT */
static void struct_decl(CType *type, int u)
{
...
            bit_pos = 0;
            offset = 0;
            while (tok != '}') {
                parse_btype(&btype, &ad); //// no check made here ?????????????????
                while (1) {
                    bit_size = -1;
                    v = 0;
                    type1 = btype;



On Thu, Jan 31, 2013 at 1:07 AM, Domingo Alvarez Duarte <address@hidden> wrote:
Also here :

static void asm_expr_logic(TCCState *s1, ExprValue *pe)
{
    int op;
    ExprValue e2;

    asm_expr_prod(s1, pe);

    for(;;) {
        op = tok;
        if (op != '&' && op != '|' && op != '^')
            break;
        next();
        asm_expr_prod(s1, &e2);

        if (pe->sym || e2.sym)
            tcc_error("invalid operation with label");
        switch(op) {
        case '&':
            pe->v &= e2.v;
            break;
        case '|': 
            pe->v |= e2.v;
            break;
        default:
        case '^':  ///////////////////////////////////////what this case after default mean ????????
            pe->v ^= e2.v;
            break;
        }
    }
}



On Thu, Jan 31, 2013 at 1:06 AM, Domingo Alvarez Duarte <address@hidden> wrote:
Hello !
I'm looking again on the reports done with Coverity Scan and found several things one of it is this:

static void asm_expr_prod(TCCState *s1, ExprValue *pe)
{
    int op;
    ExprValue e2;

    asm_expr_unary(s1, pe);
    for(;;) {
        op = tok;
        if (op != '*' && op != '/' && op != '%' &&
            op != TOK_SHL && op != TOK_SAR)
            break;
        next();
        asm_expr_unary(s1, &e2);
        if (pe->sym || e2.sym)
            tcc_error("invalid operation with label");
        switch(op) {
        case '*':
            pe->v *= e2.v;
            break;
        case '/': 
            if (e2.v == 0) {
            div_error:
                tcc_error("division by zero");
            }
            pe->v /= e2.v;
            break;
        case '%': 
            if (e2.v == 0)
                goto div_error;
            pe->v %= e2.v;
            break;
        case TOK_SHL:
            pe->v <<= e2.v;
            break;
        default:
        case TOK_SAR:    ////////////////////////////////////////this case after default what does it mean ??????????????
            pe->v >>= e2.v;
            break;
        }
    }
}



On Wed, Jan 30, 2013 at 11:08 PM, Ivo van Poorten <address@hidden> wrote:
Error:

$ ./configure --cc=tcc
Binary  directory   /usr/local/bin
TinyCC directory    /usr/local/lib/tcc
Library directory   /usr/local/lib
Include directory   /usr/local/include
Manual directory    /usr/local/share/man
Info directory      /usr/local/share/info
Doc directory       /usr/local/share/doc/tcc
Target root prefix
Source path      /home/ivo/git/tinycc
C compiler       tcc
Target OS        Linux
CPU              x86
Big Endian       no
gprof enabled    no
cross compilers  no
use libgcc       no
Creating config.mak and config.h
$ make
[..snip..]
gcc -c lib/bcheck.c -o bcheck.o -I. -I/home/ivo/git/tinycc -Wall -g -O2
-mpreferred-stack-boundary=2 -m386 -malign-functions=0 -m32 cc1: error:
unrecognized command line option "-m386"


----8<----8<----8<----8<----8<----8<----8<----8<----

diff --git a/Makefile b/Makefile
index d257464..0333ebe 100644
--- a/Makefile
+++ b/Makefile
@@ -232,7 +232,7 @@ libtcc1.a : FORCE
 lib/%/libtcc1.a : FORCE $(PROGS_CROSS)
        @$(MAKE) -C lib cross TARGET=$*
 bcheck.o : lib/bcheck.c
-       gcc -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
+       $(CC) -c $< -o $@ $(CPPFLAGS) $(CFLAGS)
 FORCE:

 # install

_______________________________________________
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]