(/home/sate/Testcases/c/cve/wireshark-1.2.0/tools/lemon/lemon.c) |
| |
| 1031 | | | static int resolve_conflict( |
| 1032 | | | struct action *apx, |
| 1033 | | | struct action *apy, |
| 1034 | | | struct symbol *errsym _U_) |
| 1035 | | | { |
| 1036 | | | struct symbol *spx, *spy; |
| 1037 | | | int errcnt = 0; |
| 1038 | | | assert( apx->sp==apy->sp );
x /usr/include/assert.h |
| |
91 | # define assert(expr) \ |
92 | ((expr) \ |
93 | ? __ASSERT_VOID_CAST (0) \ |
94 | : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) |
| |
x /usr/include/assert.h |
| |
42 | # define __ASSERT_VOID_CAST (void) |
| |
x /usr/include/assert.h |
| |
109 | # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ |
| |
|
| 1039 | | | if( apx->type==SHIFT && apy->type==SHIFT ){ |
| 1040 | | | apy->type = SSCONFLICT; |
| 1041 | | | errcnt++; |
| 1042 | | | } |
| 1043 | | | if( apx->type==SHIFT && apy->type==REDUCE ){ |
| 1044 | | | spx = apx->sp; |
| 1045 | | | spy = apy->x.rp->precsym; |
| 1046 | | | if( spy==0 || spx->prec<0 || spy->prec<0 ){ |
| 1047 | | | |
| 1048 | | | apy->type = SRCONFLICT; |
| 1049 | | | errcnt++; |
| 1050 | | | }else if( spx->prec>spy->prec ){ |
| 1051 | | | apy->type = RD_RESOLVED; |
| 1052 | | | }else if( spx->prec<spy->prec ){ |
| 1053 | | | apx->type = SH_RESOLVED; |
| 1054 | | | }else if( spx->prec==spy->prec && spx->assoc==RIGHT ){ |
| 1055 | | | apy->type = RD_RESOLVED; |
| 1056 | | | }else if( spx->prec==spy->prec && spx->assoc==LEFT ){ |
Redundant Condition
spx->prec == spy->prec always evaluates to true. This may be because: - There is a constant assignment to one or more of the variables involved.
- An earlier conditional statement has already ensured that spx->prec == spy->prec cannot be false.
- A crashing bug occurs on every path where spx->prec == spy->prec could have evaluated to false. Look for a preceding Null Pointer Dereference or Division By Zero warning.
|
|
| 1057 | | | apx->type = SH_RESOLVED; |
| 1058 | | | }else{ |
| 1059 | | | assert( spx->prec==spy->prec && spx->assoc==NONE );
x /usr/include/assert.h |
| |
91 | # define assert(expr) \ |
92 | ((expr) \ |
93 | ? __ASSERT_VOID_CAST (0) \ |
94 | : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) |
| |
x /usr/include/assert.h |
| |
42 | # define __ASSERT_VOID_CAST (void) |
| |
x /usr/include/assert.h |
| |
109 | # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ |
| |
|
| 1060 | | | apy->type = SRCONFLICT; |
| 1061 | | | errcnt++; |
| 1062 | | | } |
| 1063 | | | }else if( apx->type==REDUCE && apy->type==REDUCE ){ |
| 1064 | | | spx = apx->x.rp->precsym; |
| 1065 | | | spy = apy->x.rp->precsym; |
| 1066 | | | if( spx==0 || spy==0 || spx->prec<0 || |
| 1067 | | | spy->prec<0 || spx->prec==spy->prec ){ |
| 1068 | | | apy->type = RRCONFLICT; |
| 1069 | | | errcnt++; |
| 1070 | | | }else if( spx->prec>spy->prec ){ |
| 1071 | | | apy->type = RD_RESOLVED; |
| 1072 | | | }else if( spx->prec<spy->prec ){ |
| 1073 | | | apx->type = RD_RESOLVED; |
| 1074 | | | } |
| 1075 | | | }else{ |
| 1076 | | | assert(
x /usr/include/assert.h |
| |
91 | # define assert(expr) \ |
92 | ((expr) \ |
93 | ? __ASSERT_VOID_CAST (0) \ |
94 | : __assert_fail (__STRING(expr), __FILE__, __LINE__, __ASSERT_FUNCTION)) |
| |
x /usr/include/assert.h |
| |
42 | # define __ASSERT_VOID_CAST (void) |
| |
x /usr/include/assert.h |
| |
109 | # define __ASSERT_FUNCTION __PRETTY_FUNCTION__ |
| |
|
| 1077 | | | apx->type==SH_RESOLVED || |
| 1078 | | | apx->type==RD_RESOLVED || |
| 1079 | | | apx->type==SSCONFLICT || |
| 1080 | | | apx->type==SRCONFLICT || |
| 1081 | | | apx->type==RRCONFLICT || |
| 1082 | | | apy->type==SH_RESOLVED || |
| 1083 | | | apy->type==RD_RESOLVED || |
| 1084 | | | apy->type==SSCONFLICT || |
| 1085 | | | apy->type==SRCONFLICT || |
| 1086 | | | apy->type==RRCONFLICT |
| 1087 | | | ); |
| 1088 | | | |
| 1089 | | | |
| 1090 | | | |
| 1091 | | | } |
| 1092 | | | return errcnt; |
| 1093 | | | } |
| |