|
text |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 static_12(SINT_32 p_1, SINT_32 p_2) |
|
{ SINT_32 i = 1; SINT_32 j = 0; if (p_1 > 0) { i = i - 1; } else i = i + 1; if (p_2 > 0) { j = j + p_2; } else if (p_2 < 0) { j = j - p_2; } else { j = i; } return j; |
|
} [/INST] The error is erreur de syntax </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define ArraySize 3.0F |
|
void static_109(void) |
|
{ UINT_32 fl_arr[ (UINT_32) ArraySize ] = {0,1,2}; |
|
} [/INST] The error is la taille d'un tableau en C doit être spécifiée en utilisant un entier </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_110(void) |
|
{ |
|
} [/INST] The error is la fonction est vide </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_111(void) |
|
{ SINT_32 jump_flag = 0; |
|
start: jump_flag++; if (jump_flag < 10) { goto start; } |
|
} [/INST] The error is L'utilisation de l'instruction goto peut rendre le code difficile à lire et à maintenir </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef SINT_32 mytype; |
|
typedef struct st1 { SINT_32 a; SINT_32 b; } st1; |
|
void static_112(void) |
|
{ typedef FLOAT_32 mytype; |
|
} [/INST] The error is confusion, même alias de type avec une signification différente à l'intérieur de la fonction </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <wchar.h> |
|
void static_113(void) |
|
{ CHAR non_std_char = 'ù'; CHAR *poss_string = ""$Id: 56$""; wchar_t non_std_wchar = L'ù'; |
|
} [/INST] The error is utilisation des caractères qui ne sont pas conformes au jeu de caractères standard ASCII </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_114(BOOL bl, UINT_32 a) |
|
{ UINT_32 x; BOOL flag; flag = bl + bl; if (a) { ; } if (1 && bl) { ; } x = ( a && bl ? 1U : 0U ); |
|
} [/INST] The error is Dans la deuxième condition if (1 && bl), la condition 1 est toujours vraie, donc la vérification de bl est redondante. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_115(void) |
|
{ CHAR* str1 = ""string\ literal""; CHAR* str2 = ""string literal""; } [/INST] The error is problème de continuation de la chaîne sur plusieurs lignes. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_116 (void) |
|
{ UINT_32 x = 2u; if ( x == 1u ) { ; } if ( x != 0u ) { ; } |
|
} [/INST] The error is Pas d'erreur </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void main(void) |
|
{ |
|
} [/INST] The error is la fonction main doit toujours renvoyer un entier. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_13(void) |
|
{ SINT_32 jump_flag = 0; |
|
start: jump_flag++; if (jump_flag < 10) { goto start; } |
|
} [/INST] The error is The use of goto is usually considered bad practice, as its use leads to code that can be difficult to read and maintain. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_119(void) |
|
{ UINT_32 x; x = 2U |
|
|
|
} [/INST] The error is Nested comment found </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_120(void) |
|
{ SINT_32 b = 1; b = b | 1; |
|
} [/INST] The error is Use of bit operator on signed type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_121(void) |
|
{ BOOL flag = FALSE; switch (flag) { case TRUE: break; case FALSE: break; default: break; } |
|
} [/INST] The error is Use of boolean expression in switch. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void static_122(BOOL flag) |
|
{ if (flag) { abort(); } exit(0); |
|
} [/INST] The error is Use of abort, exit, etc. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_123(void) |
|
{ enum E_type { Enum1, Enum2 , Enum3}; UINT_32 ui; ui = Enum1; |
|
} [/INST] The error is Use of underlying enum representation value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_124(void) |
|
{ SINT_32 x = 1; ++x; |
|
} [/INST] The error is Use of prefix ++ or --. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#define cat(x) (&string[##(x)]) |
|
void static_125( UCHAR string[50], UINT_32 n) |
|
{ UCHAR *token1; token1 = cat(n); |
|
} [/INST] The error is Use of ## or # in a macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define MISMATCHEDIF 1 |
|
#if MISMATCHEDIF == 1 |
|
void static_126(void) |
|
{ |
|
} [/INST] The error is A #if has no #endif in the same file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 garray[]; |
|
void static_127( INT_32 par[] ) |
|
{ INT_32 array[] = {0,1,2}; |
|
} [/INST] The error is Array has no bounds specified. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 global_int = 0; |
|
void static_128(UINT_32* global_int) |
|
{ |
|
} [/INST] The error is Parameter has same name as global variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void test_14s(SINT_32 p_1) |
|
{ } |
|
void static_14(void (*p_proc_pointer)(SINT_32 parameter_1) ) |
|
{ p_proc_pointer = test_14s; |
|
} [/INST] The error is Procedural parameter declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct DUPLICATE |
|
{ UINT_32 field1; UINT_32 field2; |
|
}; |
|
void static_129(UINT_32 DUPLICATE) |
|
{ |
|
} [/INST] The error is Parameter has same name as type or tag. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
void static_130 (void) |
|
{ |
|
} [/INST] The error is Included file is not permitted. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void STATIC_131(UINT_32 p_1) |
|
{ UINT_32 static_131; BOOL c_1 = FALSE; if (c_1) { UINT_32 static_131 = 1u; static_131 = static_131 + 1u; } static_131 = p_1; |
|
} [/INST] The error is Name reused in inner scope. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_132(void) |
|
{ BOOL flag = FALSE; if (flag = FALSE) { } |
|
} [/INST] The error is Assignment operator in boolean expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_133(void) |
|
{ BOOL flag = FALSE; INT_32 y = 0, x = 0; if ( flag && ((x = y) == 0) ) { } |
|
} [/INST] The error is Assignment operator in RHS of && or ||. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_134(void) |
|
{ UINT_32 y = 2u, x = 0u, z = 1u; volatile UINT_32 v = 1U; UINT_32 arr[2] = { v, 1U }; x = (v + z) / (v * y); |
|
} [/INST] The error is Volatile variable in complex expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_135( p_1, p_2) |
|
UINT_32 p_1; |
|
UINT_32 p_2; |
|
{ |
|
} [/INST] The error is Parameter list is KR. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_136(void) |
|
{ UINT_32 x = 1u; BOOL flag = FALSE; if ((flag | (x != 0u)) == FALSE) { } |
|
} [/INST] The error is Bit operator with boolean operand. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_138 {UINT_32 x, :2;}; |
|
void static_138(void) |
|
{ |
|
} [/INST] The error is Anonymous bit field used in structure. </s>" |
|
"<s>[INST] find the error in this code: #define defval 0 |
|
typedef enum { LANE_0 = 0, LANE_1 = 1, LANE_LAST = 3 } lane_t; |
|
extern lane_t get_lane ( void ); |
|
void static_139( void ) |
|
{ lane_t lane = get_lane(); if ( (lane > LANE_0) && ( lane <= LANE_LAST)) { } if (defval) { } |
|
} [/INST] The error is Construct leads to infeasible code. </s>" |
|
"<s>[INST] find the error in this code: static void static_16(void) |
|
{ |
|
start:begin: ; |
|
} [/INST] The error is Multiple labels declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define defval 0 |
|
#define LOOP(x) do { x } while (0) |
|
void static_140(void) |
|
{ while (0) { } while( defval ) { } do { } while (0); LOOP(;); |
|
} [/INST] The error is Infeasible loop condition found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_142(UINT_32 , UINT_16 p_2) |
|
{ |
|
} [/INST] The error is Parameter list declarations are inconsistent. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_143(UINT_32 p_1) |
|
{ UINT_32 result; result = p_1{}; return result; |
|
} [/INST] The error is Curly brackets used in expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
FLOAT_32 static_144(FLOAT_32 p_1,FLOAT_32 p_2) |
|
{ FLOAT_32 result; result = p_1 + p_2; return result; |
|
} [/INST] The error is Floating point not permitted. </s>" |
|
"<s>[INST] find the error in this code: #define static_145 6 |
|
#if static_145 i |
|
#endif [/INST] The error is #if has invalid expression. </s>" |
|
"<s>[INST] find the error in this code: #define static_146() (""dummy()"") |
|
void dummy(void); [/INST] The error is #define with empty parameter list. </s>" |
|
"<s>[INST] find the error in this code: #ifdef STATIC_147 typedef unsigned char UCHAR; |
|
#endif ; |
|
void static_147(void) |
|
{ |
|
} [/INST] The error is Spurious characters after preprocessor directive. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static_148(UINT_32 p1); |
|
static_148(UINT_32 p1) |
|
{ |
|
} [/INST] The error is No return type for function/procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
CHAR *static_149( CHAR *p1); |
|
void test_149(void) |
|
{ CHAR *a = ""Query""; CHAR *b; b = static_149(a); |
|
} |
|
CHAR *static_149( CHAR *p1 ) |
|
{ static CHAR *newA = ""Response""; p1++; p1 = p1+1; p1 = newA; return p1; |
|
} [/INST] The error is Reference parameter to procedure is reassigned. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
volatile UINT_32 STATIC_150(void); |
|
volatile UINT_32 STATIC_150(void) |
|
{ volatile UINT_32 r; return r; |
|
} [/INST] The error is Volatile or const used in function type. </s>" |
|
"<s>[INST] find the error in this code: static void static_17(void) |
|
{ _asm { mov eax,01h } |
|
} [/INST] The error is Code insert found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 globvar; |
|
#define STATIC_151 globvar |
|
void static_151 (void) |
|
{ |
|
} [/INST] The error is Use of global variable in macro definition. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define STATIC_152 3 |
|
void static_152 (void) |
|
{ |
|
} [/INST] The error is Use of a comment in a macro definition. </s>" |
|
"<s>[INST] find the error in this code: #ifdef STATIC_153 |
|
#endif |
|
void static_153 (void) |
|
{ |
|
} [/INST] The error is Use of a comment in a pre-processor directive. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#ifdef STATIC_155 this acts as a comment, as STATIC_155 is undefined. |
|
#endif |
|
void static_155 (void) |
|
{ |
|
} [/INST] The error is Comments between preprocessor directives. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define STATIC_156(x) defined(x) |
|
#if STATIC_156(c) |
|
UINT_32 var1; |
|
#else |
|
SINT_32 var1; |
|
#endif |
|
#define c 1 |
|
#if STATIC_156(c) |
|
UINT_32 var2; |
|
#else |
|
SINT_32 var2; |
|
#endif |
|
void static_156( void ) |
|
{ |
|
} [/INST] The error is Use of 'defined' keyword in macro body. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_157(void) |
|
{ CHAR arr[6] = """"; CHAR *ptr_arr = arr; CHAR *c = ""1234567890""; c[7] = '0'; *(c+6) = '1'; ptr_arr[2] = '2'; |
|
} [/INST] The error is Modification of string literal. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_158(void) |
|
{ INT_32 a1,b1,c1,d1,e1; INT_32 a2,b2,c2,d2,e2; INT_32 a3,b3,c3,d3,e3; if( (a1==0) && (b1==0) && (c1==0) && (d1==0) && (e1==0) && (a2==0) && (b2==0) && (c2==0) && (d2==0) && (e2==0) && (a3==0) && (b3==0) && (c3==0) && (d3==0) && (e3==0) ) { } |
|
} [/INST] The error is Expression with more than *** subconditions. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_18(UINT_32 p_1, UINT_32 p_2, UINT_32 p_3, UINT_32 p_4, UINT_32 p_5, UINT_32 p_6, UINT_32 p_7, UINT_32 p_8) |
|
{ |
|
} [/INST] The error is No space between * or & and name in declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void static_159(void) |
|
{ CHAR *message = ""TEST""; if ( message != NULL ) { } if ( message != 0 ) { } |
|
} [/INST] The error is Comparing pointer with zero or NULL. </s>" |
|
"<s>[INST] find the error in this code: #define A B |
|
#define B A |
|
#define C D |
|
#define D E |
|
#define E C |
|
main(){ |
|
int B; |
|
int C; |
|
} [/INST] The error is Loop in macro expansion. </s>" |
|
"<s>[INST] find the error in this code: void Static_163( void ) |
|
{ |
|
} [/INST] The error is Function starts with upper case character. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void proc(void *ptr) { ; } |
|
void * a_proc ( void ) |
|
{ return NULL; |
|
} |
|
void static_164 ( void ) |
|
{ void * p = a_proc(); proc(p); |
|
} [/INST] The error is Use of void * pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void aproc( SINT_32 iv_param) {;} |
|
static void bproc(const SINT_32 ic_param) {;} |
|
static SINT_32 static_168 (void) |
|
{ SINT_32 loc_var = 0; aproc(loc_var); bproc(loc_var); |
|
} [/INST] The error is Call by value parameter not const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_170( void ); |
|
static void static_170( void ) |
|
{ aproc() ; |
|
} [/INST] The error is Procedure call has no prototype and no defn. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UCHAR a; |
|
UCHAR a; |
|
UCHAR b; |
|
UCHAR b = 3; |
|
extern UCHAR c; |
|
extern UCHAR c; |
|
extern UCHAR ok; |
|
UCHAR ok = 3U; |
|
static void static_172( void ) |
|
{ ; |
|
} [/INST] The error is Variable declared multiply. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_175 (void) |
|
{ |
|
} |
|
INT_32 main (void) |
|
{ |
|
} [/INST] The error is Function starts with lower case character. </s>" |
|
"<s>[INST] find the error in this code: void static_176 (void) |
|
{ char c = 'b'; switch(c) { case '\m': break; default: break; } |
|
} [/INST] The error is Non standard escape sequence in source. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 okvar, notok2; |
|
void static_177(void) |
|
{ okvar = 0; notok2 = 2; |
|
} [/INST] The error is Identifier not declared on new line. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_19( void ( * p_proc_pointer )(void) ) |
|
{ p_proc_pointer(); |
|
} [/INST] The error is Procedural para used in an uncalled procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 * oka; |
|
INT_32 b; INT_32 *notoka; |
|
void proc( INT_32 * s, INT_32 *ok); |
|
struct tag0 { INT_32 * w; INT_32 *notokq;} astr; |
|
static void static_178(void) |
|
{ oka = 0; |
|
} [/INST] The error is Declaration statement not on new line. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include ""Static_179.h"" |
|
static void static_179(void) |
|
{ ; |
|
} [/INST] The error is Extern not at start of header file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 *notoka; |
|
typedef INT_32 *ptr; |
|
void static_180(INT_32 *p1) |
|
{ *notoka = *p1; |
|
} [/INST] The error is No space between * or & and name in declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 main(void) |
|
{ INT_32 i=3; if( 1==2 ) {2;} switch(i){ } switch (i){ } while(i==0){2;} do{2;}while(i==0); for(i=0;i>2;i++){2;} |
|
} [/INST] The error is No space between if, while, for and expresn. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_182(void) |
|
{ INT_32 i; for ( i = 0;i < 5;i++ ) { i++; } |
|
} [/INST] The error is No space after semi colon in for expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_183(void) |
|
{ INT_32 i; INT_32 j; for ( i = 0; i < 5; i++ ) { i++;} |
|
} [/INST] The error is No newline after semi colon. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_185(void) |
|
{ INT_32 i=9; INT_32 j=19; INT_32 * p; i = - j; p = & j; * p = 77; *p = * p + 77; |
|
} [/INST] The error is Space between unary operator and operand. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_186( void ) |
|
{ INT_32 i = 9; INT_32 j =8; INT_32 k= 7; UINT_32 x = 3u; UINT_32 y = 17u; i= j; i = j /k; i = j <<k; i = j && k; |
|
} [/INST] The error is Space missing before or after binary operator. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 main(void) |
|
{ INT_32 iiiiiiiiiiiii = 0; iiiiiiiiiiiii = iiiiiiiiiiiii + iiiiiiiiiiiii + iiiiiiiiiiiii + iiiiiiiiiiiii + iiiiiiiiiiiii; |
|
} [/INST] The error is Input line exceeds limit. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_20_135( p_1 ) |
|
{ UINT_32 result; result = p_1 * 2; return result; |
|
} [/INST] The error is Parameter not declared explicitly. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_190( int32_t value ) |
|
{ int32_t x = 0; if( value == 0 ) { x = 1; } else { x = 0; } |
|
} [/INST] The error is { ... } contents not indented by *** spaces. </s>" |
|
"<s>[INST] find the error in this code: void notokproc1 () |
|
{ |
|
} [/INST] The error is Space between function name and parenthesis. </s>" |
|
<s>[INST] find the error in this code: static void proc1(void) { ; } [/INST] The error is Static not on separate line in function defn. </s> |
|
"<s>[INST] find the error in this code: static void proc2(void) |
|
{ |
|
} [/INST] The error is Function return type needs a new line. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define ACONSTAT 100 |
|
const INT_16 BCONSTAT = 100; |
|
void static_200 ( void ) |
|
{ INT_16 ss; ss = ACONSTAT; ss = BCONSTAT; |
|
} [/INST] The error is Define used for numeric constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define ACONSTANT 101 |
|
SINT_32 static_201(void) |
|
{ const SINT_16 max = 17; SINT_16 y = 77; SINT_16 z; z = 131; z = ACONSTANT; z = 0; z = 1; z = 2; return 0; |
|
} [/INST] The error is Use of numeric literal in expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const INT_16 con = 19; |
|
const INT_16 * pcon; |
|
static void static_203(void) |
|
{ INT_16 x; INT_16 *p; x = (INT_16)con; p = (INT_16 *)pcon; |
|
} [/INST] The error is Cast on a constant value. </s>" |
|
"<s>[INST] find the error in this code: #define goto some_total_rubbish ---------- |
|
void static_204 (void) |
|
{ ; |
|
} [/INST] The error is continue or goto not defined to rubbish. </s>" |
|
"<s>[INST] find the error in this code: #ifndef XXX |
|
#define XXX |
|
#endif |
|
static void static_209( void ) |
|
{ |
|
} [/INST] The error is Preprocessor command indented. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define my_sq_macro(X) ((X) * (X)) |
|
UINT_32 static_210(UINT_32 p1) |
|
{ return my_sq_macro(p1); |
|
} [/INST] The error is Macro name is not upper case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 test_21(UINT_32 p_1, UINT_16 p_2) |
|
{ UINT_32 result = 0; result = p_1 + p_2; return result; |
|
} |
|
void static_21(UINT_32 p_1, UINT_16 p_2) |
|
{ test_21(1u, 2u ,2u); |
|
} [/INST] The error is Number of parameters does not match. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_216( void ) |
|
{ UCHAR * pointer; UCHAR * ptr; UCHAR * aptr; |
|
} [/INST] The error is Pointer name does not have required suffix. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 Foobar; |
|
INT_32 foobar; |
|
INT_32 fOobar; |
|
void aproc(CHAR aC2, INT_32 FooBar) {;} |
|
void static_217 (void) |
|
{ struct tag{ CHAR aC1; INT_32 FooBar;} local; |
|
} [/INST] The error is Pointer name does not have required suffix. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void strstr(INT_32 x){;} |
|
void strcmp(INT_32 x){;} |
|
static void static_218 (void) |
|
{ strstr(2); strcmp(1); |
|
} [/INST] The error is Name is used in standard libraries. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef int _INT_NOK; |
|
static void static_219 ( void ) |
|
{ INT_32 _ohno; |
|
} [/INST] The error is User name starts with underscore. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct lower |
|
{ CHAR c; |
|
}; |
|
struct Upper |
|
{ CHAR c; |
|
}; |
|
union lowerun |
|
{ CHAR cu; INT_16 iu; |
|
}; |
|
typedef struct Upper lowstrtype; |
|
void static_221 (void) |
|
{ struct lower s; |
|
} [/INST] The error is Start of class/struct/union/enum lower case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 ok; |
|
INT_32 Notok; |
|
void static_222(void) |
|
{ ok = Notok; |
|
} [/INST] The error is Start of variable is upper case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 func(INT_32 p){return 7;} |
|
INT_32 GLOBpx_func(INT_32 q){return 11;} |
|
INT_32 main(void){ |
|
} [/INST] The error is No prefix for global function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum { red, green, Blue}; |
|
void static_224 ( void ) |
|
{ ; |
|
} [/INST] The error is Start of enumeration is upper case. </s>" |
|
"<s>[INST] find the error in this code: void static_225 ( void ) |
|
{ ; |
|
} [/INST] The error is Inappropriate file extension. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned UINT; |
|
enum {won=1,too=2}; |
|
struct tag{ UINT dec:2; UINT oct:02; UINT hex:0x3; UINT enumr:won; UINT decu:3u; |
|
}; |
|
void static_226 (void) |
|
{ ; |
|
} [/INST] The error is Bit field is not octal, hex or suffix u. </s>" |
|
<s>[INST] find the error in this code: #define COMMON_SYM_CONSTANT ((2U * 3U) + 2U [/INST] The error is Bracket mismatch ( or { in macro definition. </s> |
|
<s>[INST] find the error in this code: #define COMMON_SYM_CONSTANT 2U * 3U + 2U) [/INST] The error is Bracket mismatch ) or } in macro definition. </s> |
|
"<s>[INST] find the error in this code: #include ""Static_243.h"" |
|
static void static_243 ( void ) { ; } [/INST] The error is Included file not protected with #define. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Choice |
|
{ first, second, third, fourth |
|
} Choice; |
|
INT_32 a1 = 1; |
|
INT_32 errorflag = 0; |
|
static void static_245(Choice chooser) |
|
{ INT_32 b1 = 2; INT_32 c1 = 1; switch (chooser) { case first: a1 = b1; break; case second: case third: a1 = c1; if (a1 == b1) { case fourth: } break; default: errorflag = 1; break; } |
|
} [/INST] The error is Case statement in nested block. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define COMMON_MACRO(X) (ANOTHER_MACRO(X)) |
|
#define SOME_MACRO(X) (NESTED_MACRO1(X)) |
|
#define NESTED_MACRO1(X) (NESTED_MACRO2(X)) |
|
#define NESTED_MACRO2(X) (COMMON_MACRO(X)) |
|
#define ANOTHER_MACRO(X) (X) |
|
const SINT_32 s1 = 42; |
|
void static_247(void) |
|
{ SINT_32 myInt = COMMON_MACRO(SOME_MACRO(s1)); |
|
} [/INST] The error is Macro definition calls itself. </s>" |
|
"<s>[INST] find the error in this code: #define DEBUG2 2 |
|
#define DEBUG1 0 |
|
#define COMMON_MACRO(X,Y) ((X)/(Y)) |
|
#if (COMMON_MACRO(DEBUG2,DEBUG1)) == 1 |
|
#endif |
|
void static_248(void) |
|
{ |
|
} [/INST] The error is Divide by zero in preprocessor directive. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_249 (void) |
|
{ BOOL bvar = FALSE; UINT_32 u32 = 5U; u32 = u32 << bvar; |
|
} [/INST] The error is Shift operator with boolean operand. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const SINT_64 fr1 = 64l; |
|
const SINT_64 fr2 = 64L; |
|
void static_252(void) |
|
{ SINT_64 x1 = fr2; |
|
} [/INST] The error is Lower case suffix to literal number. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_2 (void) |
|
{ UINT_32 y = 0u; |
|
value_x: y = 1u; { value_x: y= 2u; } |
|
} [/INST] The error is Label name reused. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_23(UINT_32 p) |
|
{ UINT_32 x = 1u; x = x + p; return x; |
|
} |
|
INT_32 main(void) |
|
{ return (0); |
|
} [/INST] The error is Procedure is not explicitly called in code analysed. </s>" |
|
"<s>[INST] find the error in this code: #define DEBUG 1 |
|
#define DEBUG_ERROR 1 |
|
#ifdef WIN32 |
|
#include <windows.h> |
|
#endif |
|
#if DEBUG == 1 |
|
#ifdef DEBUG_ERROR |
|
#endif |
|
#elif DEBUG == 2 |
|
#else |
|
#endif |
|
void static_255(void) |
|
{ |
|
} [/INST] The error is Found #if, #ifdef, #else, #elif . </s>" |
|
"<s>[INST] find the error in this code: #include <foo.h> |
|
#include ""anotherFoo.h"" |
|
void static_257(void) |
|
{ |
|
} [/INST] The error is Filename in #include not in < > . </s>" |
|
"<s>[INST] find the error in this code: typedef enum mask_enum_type |
|
{ mask_first = 0X01, mask_all = 0xff |
|
} mask_enum_type; [/INST] The error is Hexadecimal number with lower case char. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_268(void) |
|
{ UINT_32 loop = 0U; const UINT_32 max = 10U; for (; loop < max; loop++) { } |
|
} [/INST] The error is Empty initialisation exprsn in for loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_269(void) |
|
{ UINT_32 loop; UINT_32 myVar = 0U; const UINT_32 max = 10U; for (loop = 0U; loop < max;) { } |
|
} [/INST] The error is Empty increment exprsn in for loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_270(void) |
|
{ UINT_32 loop; UINT_32 myVar = 0U; const UINT_32 max = 10U; for ( ++myVar, loop = 0U; loop < max; loop++ ) { } |
|
} [/INST] The error is For loop initialisation is not simple. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_271(void) |
|
{ UINT_32 loop; UINT_32 myVar = 0U; const UINT_32 max = 10U; for (loop = 0U; loop < max; myVar++, loop++) { } |
|
} [/INST] The error is For loop incrementation is not simple. </s>" |
|
"<s>[INST] find the error in this code: #ifndef STATIC_272_H |
|
#define STATIC_272_H |
|
#ifndef REPORT_ERRORS |
|
#define REPORT_WARNINGS |
|
#endif |
|
#endif [/INST] The error is Found #ifndef (ref. removed). </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_272.h"" |
|
static void static_272 ( void ) |
|
{ ; |
|
} [/INST] The error is Found #ifndef (ref. removed). </s>" |
|
"<s>[INST] find the error in this code: #ifndef STATIC_273_H |
|
#define STATIC_273_H |
|
#define MYSQMACRO ((X) * (X)) |
|
#endif [/INST] The error is Found #define. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_24(void) |
|
{ UINT_32 x; x = 1u; x = x + 1u; |
|
} [/INST] The error is Use of Noanalysis annotation. </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_273.h"" |
|
static void static_273 ( void ) |
|
{ ; |
|
} [/INST] The error is Found #define. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_274(void) |
|
{ UINT_32 x; UINT_32 yCoordinate; |
|
} [/INST] The error is Name found with length less than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct |
|
{ UINT_32 x_value; UINT_32 y_value; |
|
} pos_var; |
|
struct Position |
|
{ UINT_32 anon_x_value; UINT_32 anon_y_Value; |
|
}; |
|
void static_275(void) |
|
{ pos_var.x_value = 0U; pos_var.y_value = 0U; struct Position first_pos = {1U, 1U}; struct Position second_pos = {2U, 1U}; |
|
} [/INST] The error is Tag missing in struct, union or enum. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Seasons |
|
{ spring, summer, autumn, winter |
|
} Seasons; |
|
Seasons season; |
|
UINT_32 x1; |
|
void static_276(void) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; case 4: x1 = 10U; break; default: break; } |
|
} [/INST] The error is Case is not part of switch enumeration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 season; |
|
UINT_32 x1; |
|
void static_277(void) |
|
{ switch (season) { case 1: x1 = 1U; break; case 2: x1 = 4U; break; case 3: x1 = 7U; break; case 4: x1 = 10U; break; default: break; } |
|
} [/INST] The error is Switch chooser is not an enumeration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Seasons |
|
{ spring, summer, autumn, winter |
|
} Seasons; |
|
Seasons season; |
|
UINT_32 x1; |
|
void static_278(void) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; default: break; } |
|
} [/INST] The error is Switch has missing or extra cases. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_284(UINT_16 shortint) |
|
{ UINT_64 LongInt; LongInt = (UINT_64)(UINT_32)shortint; |
|
} [/INST] The error is Cast preceded by a cast. </s>" |
|
"<s>[INST] find the error in this code: #ifndef STATIC_286_H |
|
#define STATIC_286_H |
|
typedef unsigned int Uint_32; |
|
void static_286_header(void) |
|
{ |
|
} |
|
#endif [/INST] The error is Functions defined in header file. </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_286.h"" |
|
static void static_286 ( void ) |
|
{ ; |
|
} [/INST] The error is Functions defined in header file. </s>" |
|
"<s>[INST] find the error in this code: #ifndef STATIC_287_H |
|
#define STATIC_287_H |
|
#include ""c_standards.h"" |
|
const UINT_32 const_var = 99U; |
|
UINT_32 myVar = 3U; |
|
#endif [/INST] The error is Variable definition in header file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 static_25(SINT_32 p_1) |
|
{ SINT_32 i = 0, j = 0; switch (p_1) { case 0: j = 0; break; case 1: case 2: j=i; break; default: i = j + 1; } return i + j; |
|
} [/INST] The error is Null case in switch statement. </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_287.h"" |
|
static void static_287 ( void ) |
|
{ ; |
|
} [/INST] The error is Variable definition in header file. </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_288.x"" |
|
#include ""Static_288.hpp"" |
|
static void static_288 ( void ) |
|
{ ; |
|
} [/INST] The error is Header file is not .h. </s>" |
|
"<s>[INST] find the error in this code: #include <foo.h> |
|
#include<anotherFoo.h> |
|
static void static_292 (void) |
|
{ |
|
} [/INST] The error is No space between #include and filename. </s>" |
|
"<s>[INST] find the error in this code: __inline__ void check_ansi(void) |
|
{ ; |
|
} |
|
void static_293 ( void ) |
|
{ check_ansi ( ); |
|
} [/INST] The error is Non ANSI/ISO construct used. </s>" |
|
"<s>[INST] find the error in this code: static void static_295(void) |
|
<% |
|
%> [/INST] The error is Use of digraph. </s>" |
|
"<s>[INST] find the error in this code: void static_296(void) |
|
{ void bar(void); |
|
} [/INST] The error is Function declared at block scope. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern void drawline(UINT_32 length); |
|
typedef void (*fptr_nok)(UINT_32 len); |
|
typedef void (* const fptr_ok)(UINT_32 len); |
|
static void static_298(void) |
|
{ fptr_nok DRAW_FN1 = drawline; const fptr_nok DRAW_FN2 = drawline; fptr_ok DRAW_FN3 = drawline; DRAW_FN1(3U); DRAW_FN2(3U); DRAW_FN3(3U); |
|
} [/INST] The error is Non const pointer to function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern void drawline(UINT_32 length); |
|
typedef void (*fntypePtr)(UINT_32 length); |
|
typedef void (fntype)(UINT_32 length); |
|
void static_299 (void) |
|
{ fntypePtr DRAW_FN1 = drawline; fntype *DRAW_FN2 = drawline; void (*fptr)(UINT_32 len); fptr = drawline; DRAW_FN1(3U); DRAW_FN2(3U); fptr(3U); |
|
} [/INST] The error is Pointer to function declared without typedef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_26 (void) |
|
{ UINT_32 a = 0U; while (1) { } do { } while (1); for (a = 0U; ; a++) { } |
|
} [/INST] The error is Loop control expression may not terminate loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 limit = 32U; |
|
void static_301(UINT_32 myParam) |
|
{ if (myParam > limit) { myParam = limit; |
|
} |
|
} [/INST] The error is } not aligned vertically below {. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 limit = 32U; |
|
void static_302 (UINT_32 myParam) |
|
{ if (myParam > limit) { myParam = limit; } |
|
} [/INST] The error is Comment possibly contains code. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 scale = 32U; |
|
void static_304( UINT_32 myParam ) |
|
{ myParam = myParam * scale; |
|
} [/INST] The error is Arithmetic performed on unsigned values. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 scale = 32U; |
|
void static_305 (UINT_32 myParam) |
|
{ UINT_32 result = myParam * scale; |
|
} [/INST] The error is Unused inspect annotation for standard ... </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 limit = 32U; |
|
void static_307(UINT_32 myParam) |
|
{ if (myParam > limit) { |
|
#error } else { |
|
#line 4 myOtherFile.c myParam++; } |
|
} [/INST] The error is Use of #line, #error preprocessor directives. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_309 (UINT_16 *my_int_ptr) |
|
{ ; |
|
} [/INST] The error is * or & not attached to type in declaration. </s>" |
|
"<s>[INST] find the error in this code: void Static_312(void) |
|
{ |
|
} [/INST] The error is Function name is not all lower case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_313(void) |
|
{ UINT_32 myVar; |
|
} [/INST] The error is Variable name is not all lower case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum FavouriteSeasons |
|
{ spring |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
void static_314 (void) |
|
{ switch (season) { case spring: x1 = 1U; break; default: break; } |
|
} [/INST] The error is Switch has only 1 case and default. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 xstart = 1U; |
|
const UINT_32 yend = 240U; |
|
typedef struct Position |
|
{ UINT_32 xValue; UINT_32 yValue; |
|
} Position; |
|
void static_315( void ) |
|
{ Position myPos; myPos .xValue = xstart; myPos. yValue = yend; |
|
} [/INST] The error is Blank before/after . operator. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_27( UINT_32 p_1, UINT_32 p_2) |
|
{ UINT_32 result; result = p_1 + p_2; return result; |
|
} [/INST] The error is Void procedure with return statement. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct Message |
|
{ SINT_32 x_set:0x4; UINT_32 y_set:0x4; |
|
} Message; |
|
void static_316(void) |
|
{ Message message_chunk; |
|
} [/INST] The error is Bit field is not unsigned integral. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int uint_32; |
|
typedef struct Position |
|
{ uint_32 x_value; uint_32 y_value; |
|
} Position; |
|
void static_317(void) |
|
{ Position my_pos; |
|
} [/INST] The error is Typedef name doesn't start with upper case letter. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int UINT_32; |
|
typedef struct Position |
|
{ UINT_32 x_value; UINT_32 y_value; |
|
} Position; |
|
typedef enum Colour_RGB |
|
{ red, green, blue |
|
} Colour_RGB; |
|
typedef struct ACRORGB |
|
{ UINT_32 red_el; UINT_32 green_el; UINT_32 blue_el; |
|
} ACRORGB; |
|
void static_318(void) |
|
{ Position my_pos; Colour_RGB col = red; ACRORGB my_col_struct; |
|
} [/INST] The error is Upper case letter found after first character. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum FavouriteSeasons |
|
{ spring, summer, autumn, winter |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
static void static_322(void) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; default: break; case winter: x1 = 10U; break; } |
|
} [/INST] The error is Default is not last case of switch. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum FavouriteSeasons |
|
{ spring, summer, autumn, winter |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
void static_323(void) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; case winter: x1 = 10U; break; default: break; default: break; } |
|
} [/INST] The error is Switch has more than one default case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define COMMON_MACRO(X, Y) ((X) * (Y)) |
|
const SINT_32 s1 = 42; |
|
void static_324(void) |
|
{ SINT_32 myInt = COMMON_MACRO(s1); |
|
} [/INST] The error is Macro call has wrong number of parameters. </s>" |
|
"<s>[INST] find the error in this code: typedef signed int Sint_32; |
|
typedef signed char Char; |
|
void foo(void) |
|
{ { struct tag_name { Sint_32 tag_component2; } tag_name2; } { union tag_name { Sint_32 tag_component3; Char tag_component4; } tag_name3; } |
|
} [/INST] The error is Inconsistent use of tag. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static foo(void); |
|
static SINT_32 static_326(void); [/INST] The error is Declaration is missing type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct Message |
|
{ UINT_32 x_set:0x4; UINT_32 y_set:0x4; UINT_32 z_set; |
|
} Message; |
|
void static_328(void) |
|
{ Message message_chunk; |
|
} [/INST] The error is Non bit field member in bitfield struct. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_329( char ch8, SINT_8 s8, SINT_16 s16 ) |
|
{ char cha; SINT_8 s8a; SINT_16 s16a; ch8++; s16a = ch8 + s16; s8a = ch8 + s8; s8a = ch8 + 4; |
|
} [/INST] The error is Operation not appropriate to plain char. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_29(void) |
|
{ UINT_32 x = 1u; UINT_32 y = 2u; UINT_32 z = 3u; x += 1u; z -= y; |
|
} [/INST] The error is Use of += or -= operators found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_331(void) |
|
{ UINT_32 x1 = 5; UINT_32 y1 = 6U; UINT_64 z1 = 0; y1 = y1 * 7; |
|
} [/INST] The error is Literal value requires a U suffix. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned short Uint_16; |
|
typedef unsigned int Uint_32; |
|
Uint_16 u16a = 40000U; |
|
Uint_16 u16b = 30000U; |
|
void static_332( void ) |
|
{ Uint_32 u32 = (Uint_32) (u16a + u16b); u32 = (Uint_32)(++u16a); |
|
} [/INST] The error is Widening cast on complex integer expression. </s>" |
|
"<s>[INST] find the error in this code: typedef float Float_32; |
|
typedef double Float_64; |
|
void static_333(void) |
|
{ Float_32 f32a = 4.0F; Float_32 f32b = 3.0F; Float_64 f64 = (Float_64) (f32a + f32b); |
|
} [/INST] The error is Widening cast on complex float expression. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned short Uint_16; |
|
typedef unsigned char Uint_8; |
|
Uint_8 port = 0x5aU; |
|
Uint_16 mode = 0xffff; |
|
Uint_16 result_16; |
|
Uint_16 another_result_16; |
|
void static_334 (void) |
|
{ result_16 = ((port << 4) & mode) >> 6; another_result_16 = ((Uint_16)((Uint_16)port << 4) & mode) >> 6; |
|
} [/INST] The error is No cast when ~ or << applied to small types (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 max_value = 255U; |
|
#if defined(X > Y) |
|
#endif [/INST] The error is Operator defined contains illegal items. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 max_value = 255U; |
|
#define DEFINED defined |
|
#if DEFINED(X) |
|
#endif [/INST] The error is #if expansion contains define operator. </s>" |
|
"<s>[INST] find the error in this code: #if DEBUG1 |
|
#else |
|
#endif |
|
void static_337(void) |
|
{ |
|
} [/INST] The error is Undefined macro variable in #if. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int Uint_32; |
|
#include ""c_standards.h"" |
|
void static_338(void) |
|
{ ; |
|
} [/INST] The error is #include preceded by non preproc directives. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include ""bar.h"" |
|
void static_339(void) |
|
{ ; |
|
} [/INST] The error is #include directive with illegal items. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define COMMON_MACRO(X, Y) ((X) * (Y)) |
|
const SINT_32 s1 = 42; |
|
const SINT_32 s2 = 7; |
|
SINT_32 static_340(void) |
|
{ SINT_32 myInt = COMMON_MACRO(s1, s2); return myInt; |
|
} [/INST] The error is Use of function like macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo( UINT_32 p_x) |
|
{ |
|
} |
|
void static_30(void) |
|
{ UINT_32 x = 1u; UINT_32 y = 2u; BOOL flag = FALSE; if (flag == FALSE) { x++; } x = x + y++; foo( x++ ); |
|
} [/INST] The error is Deprecated usage of ++ or -- operators found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define S1 |
|
#define COMMON_MACRO(X) (X) |
|
SINT_32 static_341(void) |
|
{ SINT_32 my_int = COMMON_MACRO( |
|
#ifdef S1 1 |
|
#else 2 |
|
#endif ); return my_int; |
|
} [/INST] The error is Preprocessor construct as macro parameter. </s>" |
|
"<s>[INST] find the error in this code: #define DIAGS |
|
typedef enum Flag |
|
{ on, off |
|
} Flag; |
|
#ifdef DIAGS Flag x1 = on; |
|
#else1 Flag x1 = off; |
|
#endif |
|
void static_342 (void) |
|
{ ; |
|
} [/INST] The error is Extra chars after preprocessor directive. </s>" |
|
"<s>[INST] find the error in this code: #define DEBUG1 1 |
|
#if DEBUG1 == 1 |
|
#include ""Static_343.h"" |
|
#else |
|
#endif [/INST] The error is #else has no #if, etc in the same file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
volatile UINT_32 * vp1; |
|
UINT_32 * volatile pv2; |
|
static void static_344 ( void ) |
|
{ UINT_32 *y2 = (UINT_32 *)vp1; y2 = (UINT_32 *)pv2; |
|
} [/INST] The error is Cast on volatile value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_345(FLOAT_32 fl1) |
|
{ UINT_8 bitmap = ~fl1; |
|
} [/INST] The error is Bit operator with floating point operand. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Range |
|
{ first, second, third |
|
} Range; |
|
typedef struct Message |
|
{ UINT_32 ui_set:0x4; UCHAR uc_set:0x1; SINT_32 si_set:0x4; FLOAT_32 y_set:0x8; Range z_set:0x2; |
|
} Message; |
|
void static_346(void) |
|
{ Message message_chunk; |
|
} [/INST] The error is Bit field is not unsigned integral or enum type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define PENALTY_MACRO (XIN, YIN) ((XIN) * (YIN)) |
|
#define GOOD_MACRO(XIN, YIN) ((XIN) + (YIN)) |
|
const SINT_32 s1 = 42; |
|
const SINT_32 s2 = 7; |
|
SINT_32 static_347(void) |
|
{ SINT_32 myInt = GOOD_MACRO( s1, s2); return myInt; |
|
} [/INST] The error is Macro parameter list has leading space. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void static_348( void ) |
|
{ UCHAR * uc = NULL; if( uc == 0 ) { ; } |
|
} [/INST] The error is Use of the NULL macro. </s>" |
|
"<s>[INST] find the error in this code: typedef enum Seasons |
|
{ SPRING, summer, autumn, winter |
|
} Seasons; |
|
static void static_349(Seasons season) |
|
{ |
|
} [/INST] The error is Enumeration is not all lower case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_31 (void) |
|
{ SINT_32 i=10 ; while (i > -1) { if (i == 0) { break; } i = i - 1; } |
|
} [/INST] The error is Use of break statement in loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 DEFINT = 1U; |
|
void static_350(void) |
|
{ UINT_32 my_int = DEFINT; |
|
} [/INST] The error is Const variable is not all lower case. </s>" |
|
"<s>[INST] find the error in this code: void static_351(void) |
|
{ enum { up, down } direction; |
|
} [/INST] The error is Type declaration with variable definition. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Seasons |
|
{ spring, summer, autumn, winter |
|
} Seasons; |
|
Seasons static_352 (INT_32 month) |
|
{ Seasons ss; return ss; |
|
} [/INST] The error is Declaration of type not in header file. </s>" |
|
"<s>[INST] find the error in this code: #ifndef STATIC_354_H |
|
#define STATIC_354_H |
|
#include ""c_standards.h"" |
|
extern UINT_32 day; |
|
#endif |
|
#include ""Static_354.h"" |
|
UINT_32 day = 1U; |
|
extern UINT_32 season; |
|
static void static_354 (void) |
|
{ |
|
} [/INST] The error is Extern declaration is not in header file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_355(void) |
|
{ UINT_32 s12345678901234567890123456789012345678901234567890123456789012_a; UINT_32 s12345678901234567890123456789012345678901234567890123456789012_b; |
|
} [/INST] The error is Variables not unique within *** characters. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_356(void) |
|
{ UINT_32* uptr[10]; UINT_32 **upp; upp = uptr; |
|
} [/INST] The error is Pointer to pointer declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern incompatible_int; |
|
UCHAR incompatible_int = '0'; |
|
void static_360 (void) |
|
{ |
|
} [/INST] The error is Incompatible type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 static_361(SINT_32 x1, SINT_32 x2, SINT_32 x3) |
|
{ SINT_32 z1; z1 = z1 * x2 >> 3U; z1 = x1 * x2 + x3; z1 = x1 * x2++; z1 = x1 + x2 - x3; z1 = x1 + x2 + x3; return z1; |
|
} [/INST] The error is Expression needs brackets. </s>" |
|
"<s>[INST] find the error in this code: typedef enum mask_enum_type |
|
{ mask_first = 0x01, mask_all = 0xFF |
|
} mask_enum_type; [/INST] The error is Hexadecimal number with upper case char. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_32 ( SINT_32 p_1) |
|
{ SINT_32 i = p_1; SINT_32 x = 0; while ( i != 0 ) { i--; if ( x == 0 ) { continue; } } |
|
} [/INST] The error is Use of continue statement. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
void static_366 (void) |
|
{ printf(""This is quite a long text string that\ |
|
spans several lines\n""); |
|
} [/INST] The error is String continuation - use of \. </s>" |
|
"<s>[INST] find the error in this code: #define S1(X) (\ |
|
(X) + ((X) * 2)) |
|
void static_367 ( void ) |
|
{ ; |
|
} [/INST] The error is Macro continuation - use of \. </s>" |
|
"<s>[INST] find the error in this code: #pragma This is just an example using \ to continue a pragma. |
|
#pragma Another example ""using"" \ but with a string before it! [/INST] The error is Pragma continuation - use of \. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_369(void) |
|
{ UINT_32 my_over_sixty_characters_long_non_compliant_integer_type_instance; |
|
} [/INST] The error is Name found with length greater than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 top_value = 255U; |
|
void static_370(UINT_32 a1, UINT_32 a2, UINT_32 a3) |
|
{ if (a1 > a3) { if (a1 > a2) { if (a2 > a3) { if (a2 < top_value) { if (a1 > top_value) { } } } } } |
|
} [/INST] The error is If nest depth greater than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 x1 = 5U; |
|
const UINT_32 x2 = 3U; |
|
void call(UINT_32 a1, UINT_32 a2) |
|
{ if (a1 > a2) { } |
|
} |
|
void static_371 (void) |
|
{ call(x1,x2); |
|
} [/INST] The error is No space after comma in parameter list. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_372(INT_32* my_int_ptr) |
|
{ ; |
|
} [/INST] The error is * or & not attached to name in declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_373(void) |
|
{ const INT_32 x1 = -5; const INT_32 x2 = 3; INT_32 b1 = x1 / x2; |
|
} [/INST] The error is Use of integer division. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int unique_type; |
|
void static_374( void ) |
|
{ unique_type unique_type; |
|
} [/INST] The error is Name conflict with typedef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_376(void) |
|
{ CHAR octal_escape, n_octal_escape; n_octal_escape = '\01'; n_octal_escape = '\109'; octal_escape = '\0'; |
|
} [/INST] The error is Use of octal escape sequence. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_33( UINT_32 p_1 ) |
|
{ UINT_32 val0 = 0u; UINT_32 val1 = 1u; UINT_32 result; result = ( p_1 == 0u ) ? val0 : val1 ; |
|
} [/INST] The error is Use of ternary operator found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_377(void) |
|
{ CHAR * n_octal_point = ""abc\017""; |
|
} [/INST] The error is Null character used within a string. </s>" |
|
"<s>[INST] find the error in this code: typedef enum my_enum |
|
{ first, second, third |
|
} seq_enum; |
|
void static_378 ( seq_enum pos ) |
|
{ |
|
} [/INST] The error is Tag and type mismatch in struct/union/enum. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const SINT_32 m1 = 4; |
|
const SINT_32 m2 = 3; |
|
#define MIN(a, b) ((a) \ < \ (b) \ ? (a) \ : (b) \ ) |
|
void static_379(void) |
|
{ SINT_32 res = MIN(m1, m2); |
|
} [/INST] The error is Macro exceeds *** continuation lines. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum my_enum |
|
{ first, second, third |
|
} my_enum; |
|
void static_380(void) |
|
{ enum my_enum pos; |
|
} [/INST] The error is Enumeration element not on a new line. </s>" |
|
"<s>[INST] find the error in this code: enum my_enum |
|
{ first, second, third |
|
}; |
|
void static_381(void) |
|
{ enum my_enum pos; |
|
} [/INST] The error is Enum, struct or union not typedeffed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 my_const = 42U; |
|
UINT_32 a_fn(UINT_32 us1) |
|
{ return us1; |
|
} |
|
void static_382(void) |
|
{ a_fn(my_const); (void)a_fn(my_const); |
|
} [/INST] The error is (void) missing for discarded return value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define X2(X) ((X) + (X)) |
|
UINT_32 X2; |
|
UINT_32 static_383(UINT_32 us1) |
|
{ return us1; |
|
} [/INST] The error is Identifier name matches macro name. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define ABCDEFGHIJKLMNOPQRSTUVWXYZ1234_M(X) ((X) + (X)) |
|
#define ABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBA12345678987_M(X) ((X) + (X)) |
|
UINT_32 ABCDEFGHIJKLMNOPQRSTUVWXYZ1234_V; |
|
UINT_32 ABCDEFGHIJKLMNOPQRSTUVWXYZZYXWVUTSRQPONMLKJIHGFEDCBA12345678987_V; |
|
static UINT_32 static_384(UINT_32 us1) |
|
{ return us1; |
|
} [/INST] The error is Identifier matches macro name up to max significant chars. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum FavouriteSeasons |
|
{ spring, summer, autumn, winter |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
void static_385(void) |
|
{ switch (season) { UINT_32 decl_b4_1st_case; case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; case winter: x1 = 10U; break; default: break; } |
|
} [/INST] The error is MISRA switch statement syntax violation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void) |
|
{ |
|
} |
|
void static_386(UINT_32 p1) |
|
{ foo(); |
|
} [/INST] The error is Less than *** blank lines separating procs. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL isHexDigit( CHAR Hex ) |
|
{ BOOL bResult = FALSE; if ((Hex == '0') || (Hex == '1') || (Hex == '2') || (Hex == '3') || (Hex == '4') || (Hex == '5') || (Hex == '6') || (Hex == '7') || (Hex == '8') || (Hex == '9') || (Hex == 'A') || (Hex == 'a') || (Hex == 'B') || (Hex == 'b') || (Hex == 'C') || (Hex == 'c') || (Hex == 'D') || (Hex == 'd') || (Hex == 'E') || (Hex == 'e') || (Hex == 'F') || (Hex == 'f')) { bResult = TRUE; } return bResult; |
|
} [/INST] The error is Cyclomatic complexity greater than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_34(); |
|
UINT_32 static_34(UINT_32 p) |
|
{ return p; |
|
} [/INST] The error is No parameters declared in proc specification. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 s4 = 4U; |
|
typedef enum FavouriteSeasons |
|
{ spring = 1, summer = 2, autumn = 3, winter = s4 |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
void static_387(void) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; case winter: x1 = 10U; break; default: break; } |
|
} [/INST] The error is Enum init not integer-constant-expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 limit = 99U; |
|
void static_388(void) |
|
{ extern UINT_32 x1; if (limit == x1) { } |
|
} [/INST] The error is Extern used in function body. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Bool |
|
{ false, true |
|
} Bool; |
|
const UINT_32 limit = 99U; |
|
void static_389(UINT_32 x1) |
|
{ Bool b1 = false; if (limit == x1) { b1++; } |
|
} [/INST] The error is Bool value incremented/decremented. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef CHAR arraytype[20]; |
|
static void static_390(void ) |
|
{ ; |
|
} [/INST] The error is Typedef array declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_397 (void) |
|
{ INT_32 my_array[3] = { 1, 2 }; INT_32 array2[2][2] = { {0}, {1,2} }; CHAR char_10[10] = ""Hello""; |
|
} [/INST] The error is Array initialisation has insufficient items. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_398(void) |
|
{ UINT_32 lowertest1, test; if (!(lowertest1 <= test)) { ; } if (lowertest1 > test) { ; } |
|
} [/INST] The error is Boolean negation outside bracketed exprsn. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_399(SINT_32 p1); |
|
void static_399(SINT_32 p1); |
|
void static_399(UINT_32 p1); |
|
UINT_32 static_399(SINT_32 p1); [/INST] The error is Function declared more than once. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct My_struct |
|
{ UINT_16 x1; UINT_16 x2; |
|
}; |
|
UINT_32 static_400( void ) |
|
{ return sizeof(struct My_struct); |
|
} [/INST] The error is Use of sizeof on a type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_401(CHAR str[]) |
|
{ UINT_32 sz = sizeof(str); |
|
} [/INST] The error is Use of sizeof on an array parameter. </s>" |
|
"<s>[INST] find the error in this code: typedef enum Bool |
|
{ false, true |
|
} Bool; |
|
void static_402(Bool b1) |
|
{ Bool b2 = true; if (b1 == b2) { } |
|
} [/INST] The error is Comparison of booleans. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static BOOL static_35(UINT_32 p_1) |
|
{ BOOL ret = ( p_1 == 1U ); return ret; |
|
} [/INST] The error is Static procedure is not explicitly called in code analysed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_403( INT_32 si ) |
|
{ UINT_32 my_var = 2U; const INT_32 s1 = -2; my_var = my_var << -1; my_var = my_var >> s1; my_var = my_var >> si; |
|
} [/INST] The error is Negative (or potentially negative) shift. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_404(void) |
|
{ INT_32 my_array[3] = { 1, 2, 3, 4 }; char char3[3] = ""abcd""; char char4[4] = ""abcd""; char char5[5] = ""abcd""; |
|
} [/INST] The error is Array initialisation has too many items. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define MY_MACRO(X) ((X) * (MY_MACRO((X) + 1))) |
|
void static_405 ( void ) |
|
{ INT_32 v = MY_MACRO(3); |
|
} [/INST] The error is Macro name appears in own replacement list. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 max_num = 10U; |
|
void static_406(BOOL is_high, UINT_32 p1) |
|
{ if (is_high && (max_num == p1++)) { } |
|
} [/INST] The error is Use of ++ or -- on RHS of && or || operator. </s>" |
|
"<s>[INST] find the error in this code: #include <stdlib.h> |
|
void static_407(void) |
|
{ char *str = ""abcde""; free(str); |
|
} [/INST] The error is free used on string. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const UINT_32 max_num = 10; |
|
void static_408(BOOL is_high, UINT_32 p1) |
|
{ volatile UINT_32 v1; if (is_high && (max_num == v1)) { } |
|
} [/INST] The error is Volatile variable accessed on RHS of && or ||. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
const INT_32 max_num = 10; |
|
void static_409( char arr[] ) |
|
{ INT_32 sub; for (sub = 0; sub < max_num; sub++) { if (arr[sub] == '\0') { break; } (void) printf(""%c"", arr[sub]); if (arr[sub] == 'z') { break; } } |
|
} [/INST] The error is More than one break or goto statement in loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum FavouriteSeasons |
|
{ spring, summer, autumn, winter |
|
} FavouriteSeasons; |
|
FavouriteSeasons season; |
|
UINT_32 x1; |
|
void static_410( void ) |
|
{ switch (season) { case spring: x1 = 1U; break; case summer: x1 = 4U; break; case autumn: x1 = 7U; break; case winter: x1 = 10U; break; default: break; } |
|
} [/INST] The error is Switch empty default has no comment (MR). </s>" |
|
"<s>[INST] find the error in this code: typedef enum Seasons |
|
{ spring = 1, summer, autumn, winter |
|
} Seasons; |
|
void static_411(void) |
|
{ Seasons season = winter; season++; |
|
} [/INST] The error is Inappropriate value assigned to enum. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum Seasons |
|
{ spring, summer, autumn, winter |
|
}; |
|
void static_413(void) |
|
{ ; |
|
} [/INST] The error is User type declared but not used in code analysed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_36 ( UINT_32 p_1 ) |
|
{ UINT_32 y = p_1; |
|
} |
|
int main ( void ) |
|
{ UINT_32 x = 1; static_36( x ); |
|
} [/INST] The error is Function has no return statement. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
const INT_32 max_num = 10; |
|
void static_415(char arr[10]) |
|
{ INT_32 sub; for (sub = 0; sub < max_num; sub++) { if (arr[sub] == '\0') { break; } (void) printf(""%c"", arr[sub]); } |
|
} [/INST] The error is Single dimension array param size specified. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
const INT_32 max_num = 10; |
|
void static_416(char arr[10][2]) |
|
{ INT_32 sub; for (sub = 0; sub < max_num; sub++) { if (arr[sub][0] == '\0') { break; } (void) printf(""%c"", arr[sub][0]); } |
|
} [/INST] The error is First array param dimension specified. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define DEBUG1 1 |
|
#if DEBUG1 |
|
const UINT_32 init = 1U; |
|
#else |
|
const UINT_32 init = 0; |
|
#endif |
|
void static_417(void) |
|
{ |
|
} [/INST] The error is Use of #if preprocessor command. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef UINT_32* My_ptr, Value; |
|
void static_422 (My_ptr ptr, Value val) |
|
{ |
|
} [/INST] The error is More than one synonym in typedef. </s>" |
|
"<s>[INST] find the error in this code: typedef float Float_32; |
|
typedef double Float_64; |
|
void static_425(void) |
|
{ Float_32 my_floata = 3.5F; Float_64 my_double = 4.5; Float_32 my_floatb = 2.5; Float_32 my_floatc = 6; |
|
} [/INST] The error is float literal with no F suffix. </s>" |
|
"<s>[INST] find the error in this code: #define AA 1 |
|
#undef BB |
|
static void static_426 (void) |
|
{ |
|
#define BB 2 |
|
#undef CC |
|
} [/INST] The error is #undef used in a block. </s>" |
|
"<s>[INST] find the error in this code: #define MYFILE ""myfile.h"" |
|
#include MYFILE |
|
#include filename.h |
|
static void static_427(void) |
|
{ |
|
} [/INST] The error is Filename in #include not in < > or "" "". </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum Seasons |
|
{ spring, summer, autumn, winter |
|
} Seasons; |
|
void static_428(Seasons season) |
|
{ UINT_16 weather_score; switch (season) case spring: { weather_score = 1U; break; } case summer: { weather_score = 3U; break; } case autumn: { weather_score = 2U; break; } case winter: { weather_score = 0U; break; } default: { weather_score = 0U; break; } |
|
} [/INST] The error is No {} for switch (added by Testbed). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_429( void ) |
|
{ UINT_32 index; for (index = 0; ; index++) { } |
|
} [/INST] The error is Empty middle expression in for loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
const SINT_32 max_ind = 10; |
|
void static_430 (void) |
|
{ for (SINT_32 index = 0; index < max_ind; printf(""index = %d\n"", index)) { index = index + 2; } |
|
} [/INST] The error is Inconsistent usage of loop control variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_37 ( UINT_32 ); |
|
void static_37 ( UINT_32 ) |
|
{ ; |
|
} [/INST] The error is Procedure parameter has a type but no identifier. </s>" |
|
"<s>[INST] find the error in this code: void static_433(long s64) |
|
{ int s32; bool bl = 5; s32 = bl; char ch = s64; ch = ch + 1; ch = 0; ch = 0xf; ch = (short) s32; |
|
} [/INST] The error is Type conversion without cast. </s>" |
|
"<s>[INST] find the error in this code: typedef signed char SINT_8; |
|
typedef signed int SINT_32; |
|
typedef unsigned int UINT_32; |
|
void static_434(SINT_8 s8, FLOAT_32 f32) |
|
{ UINT_32 u32; SINT_32 s32; u32 = 4; u32 = 3L; s32 = u32; s32 = 4U; u32 = s32 + u32; u32 = 4 + u32; u32 = (SINT_32)f32; |
|
} [/INST] The error is Signed/unsigned conversion without cast. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_435(FLOAT_32 ff, SINT_8 s8, FLOAT_64 f64) |
|
{ FLOAT_32 f32; SINT_32 s32; s32 = ff; f32 = s32; f32 = s8; f32 = 4; f32 = 4 + ff; f32 = 0; f32 = (SINT_32)f64; |
|
} [/INST] The error is Float/integer conversion without cast. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_436 (INT_8 * ptr, INT_8 arr[10]) |
|
{ INT_8 * p1 = ptr; INT_8 * p2 = arr; ptr[5] = 0; p1[5] = 0; p2[5] = 0; |
|
} [/INST] The error is Declaration does not specify an array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_437(void) |
|
{ INT_32 ss1[10]; INT_32 ss2[10]; INT_32 *ss1_ptr = &ss1[0]; INT_32 *ss2_ptr = &ss2[0]; if (ss1_ptr > ss2_ptr) { } |
|
} [/INST] The error is < > <= >= used on different object pointers. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_438(void) |
|
{ SINT_32 ss1[10]; SINT_32 ss2[10]; SINT_32 *ss1_ptr = &ss1[0]; SINT_32 *ss2_ptr = &ss2[0]; SINT_32 ss3 = ss1_ptr - ss2_ptr; |
|
} [/INST] The error is Pointer subtraction not addressing one array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_439 (INT_32 *ss_ptr) |
|
{ INT_32 ss = (INT_32)ss_ptr; |
|
} [/INST] The error is Cast from pointer to integral type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_440(INT_32 ss) |
|
{ INT_32 *ss_ptr = (INT_32 *)ss; ss_ptr = (INT_32 *)0x8ff7ffff; |
|
} [/INST] The error is Cast from integral type to pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_441( void ) |
|
{ UINT_16 u16r; CHAR chr; FLOAT_32 f32a, f32b; u16r = (UINT_16)(f32a + f32b); u16r = (UINT_16)(f32a); chr = (CHAR)(f32a); |
|
} [/INST] The error is Float cast to non-float. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_442( void ) |
|
{ UINT_32 u32; INT_32 s32a, s32b; u32 = (UINT_32)(s32a + s32b); u32 = (UINT_32)(s32a); |
|
} [/INST] The error is Signed integral type cast to unsigned. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_39( void ) |
|
{ FLOAT_32 f = 0.0F; for ( f = 0.0F; f < 10.0F; f = f + 1.0F ) { ; } |
|
} [/INST] The error is Unsuitable type for loop variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_443( void ) |
|
{ INT_32 s32; UINT_32 u32a, u32b; s32 = (INT_32)(u32a + u32b); s32 = (INT_32)(u32a); |
|
} [/INST] The error is Unsigned integral type cast to signed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_444( SINT_8 s8a, SINT_8 s8b, SINT_64 s64a, SINT_64 s64b ) |
|
{ FLOAT_32 f32 = (FLOAT_32)( s64a + s64b ); FLOAT_32 f32 = (FLOAT_32)( s8a + s8b ); char ch = ( char )(s64a + s64b); ch = ( char ) s64a; |
|
} [/INST] The error is Integral type cast to non-integral. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_445( void ) |
|
{ FLOAT_32 f32; FLOAT_64 f64a, f64b; f32 = f64a + f64b; f32 = ( FLOAT_64 )f32; |
|
} [/INST] The error is Narrower float conversion without cast. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_446 ( void ) |
|
{ UINT_16 u16; UINT_32 u32a, u32b; u16 = u32a + u32b; u16 = 3U; u16 = 3UL; u16 = (UINT_32)u16; |
|
} [/INST] The error is Narrower int conversion without cast. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const INT_32 max_ind = 10; |
|
INT_32 flag = 1; |
|
static void static_447(void) |
|
{ for (INT_32 index = 0; (index < max_ind) && (flag > 0); index++) { } |
|
} [/INST] The error is Loop termination not a simple constant test. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_450(void) |
|
{ CHAR *text = L""Wide string """"and string""; |
|
} [/INST] The error is Wide string and string concatenated. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_451( void ) |
|
{ FLOAT_64 f64; FLOAT_32 f32a, f32b; f64 = f32a + f32b; u64a = u32a++; |
|
} [/INST] The error is No cast for widening complex float expression (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_452(void) |
|
{ UINT_64 u64a; UINT_32 u32a, u32b; u64a = u32a + u32b; u64a = u32a++; |
|
} [/INST] The error is No cast for widening complex int expression (MR). </s>" |
|
"<s>[INST] find the error in this code: typedef float Float_32; |
|
typedef double Float_64; |
|
Float_64 static_456( void ) |
|
{ Float_32 f32a; return (f32a); |
|
} [/INST] The error is Implicit float widening for function return (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_16 static_457(void) |
|
{ UINT_8 u8a; return u8a; |
|
} [/INST] The error is Implicit int widening for function return (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 global_f = 0; |
|
SINT_32 loop_standards (SINT_32 p_1) |
|
{ SINT_32 j = 10; for (global_f = 0; global_f < 10; global_f = global_f + 1) { j--; } return j; |
|
} [/INST] The error is Loop index is not declared locally. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int Uint_32; |
|
typedef unsigned long Uint_64; |
|
static void narrow_int(Uint_32 u32b) |
|
{ ; |
|
} |
|
static void static_458(void) |
|
{ Uint_64 u64a; narrow_int(u64a); |
|
} [/INST] The error is Implicit conversion: actual to formal param (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void foo(UINT_32 *uptr) |
|
{ |
|
} |
|
void static_459(void) |
|
{ UINT_32 uarray[10]; foo(uarray); |
|
} [/INST] The error is Array passed as actual parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern UINT_8 x; |
|
static UINT_8 x = 0u; |
|
static void static_461(void) |
|
{ |
|
} [/INST] The error is Identifier with ambiguous linkage. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct MyStruct |
|
{ UINT_32 x1; UINT_32 x2; UINT_32 x3; |
|
} MyStruct; |
|
void static_462(void) |
|
{ MyStruct a_struct = {1, 2}; MyStruct b_struct = {0}; |
|
} [/INST] The error is Struct initialisation has insufficient items. </s>" |
|
"<s>[INST] find the error in this code: static struct { char * string; int anint; } types [] = { { ""one green bottle"",1}, { ""two green bottles"",2}, { ""three green bottles"",3}, }; |
|
static void static_463( void ) |
|
{ ; |
|
} [/INST] The error is Unnecessary comma in initialisation list. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
auto UINT_32 glob_var; |
|
static void static_464(void) |
|
{ UINT_32 r1; auto UINT_32 local_var; |
|
} [/INST] The error is Use of auto specifier. </s>" |
|
"<s>[INST] find the error in this code: struct static_465_s; |
|
void static_465(void) |
|
{ |
|
} [/INST] The error is Struct/union not completely specified. </s>" |
|
"<s>[INST] find the error in this code: typedef signed long Sint_64; |
|
typedef unsigned long Uint_64; |
|
const Sint_64 slong = 1; |
|
const Sint_64 slong_ok = 1L; |
|
const Uint_64 ulong = 2U; |
|
const Uint_64 ulong_ok = 2UL; |
|
void static_466 (void) |
|
{ |
|
} [/INST] The error is long literal with no L suffix. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 static_471 (void) |
|
{ return 42; |
|
} [/INST] The error is Function returns constant value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_472(void); |
|
void static_472(void) |
|
{ char * entry_name = ""Anon.""; INT_32 entry_number = 0; |
|
} [/INST] The error is No comment after declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdarg.h> |
|
void static_41(UCHAR* p_1, ...); |
|
void static_41(UCHAR* p_1, ...) |
|
{ va_list ap; UCHAR* t; va_start(ap, p_1); t = va_arg(ap, UCHAR*); va_end(ap); |
|
} [/INST] The error is Ellipsis used in procedure parameter list. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
#define STRING_BUFFER_LENGTH 256 |
|
typedef struct |
|
{ int stringSize; char stringBuffer[STRING_BUFFER_LENGTH]; |
|
} sized_string; |
|
struct another_string |
|
{ int stringLength; char stringContainer[STRING_BUFFER_LENGTH]; |
|
}; |
|
void static_473(void) |
|
{ sized_string myString; struct another_string myContainer; myContainer.stringLength = myString.stringSize; memcpy(myContainer.stringContainer, myString.stringBuffer, myContainer.stringLength); |
|
} [/INST] The error is Typedef should not be used. </s>" |
|
"<s>[INST] find the error in this code: typedef enum Bool |
|
{ FALSE, TRUE |
|
} Bool; |
|
typedef enum MyEnum |
|
{ First, Second, THIRD |
|
} MyEnum; |
|
void static_474(MyEnum ee) |
|
{ Bool top_two = FALSE; if (ee == First) { top_two = TRUE; } else { if (ee == Second) { top_two = TRUE; } else { top_two = FALSE; } } |
|
} [/INST] The error is Enum name is not all upper case. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define IN |
|
SINT_32 static_475(IN SINT_32 si); |
|
SINT_32 static_475(SINT_32 si) |
|
{ return si; |
|
} [/INST] The error is Parameter needs IN/OUT/INOUT marker. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_476(INT_32 si) |
|
{ UINT_32 my_array[3] = {0, 0, 0}; UINT_32 element = my_array[si]; |
|
} [/INST] The error is Array index not unsigned. </s>" |
|
"<s>[INST] find the error in this code: typedef enum Pos |
|
{ FIRST, SECOND, THIRD |
|
} Pos; |
|
typedef enum Bool |
|
{ FALSE, TRUE |
|
} Bool; |
|
Bool foo(const Pos xx); |
|
Bool foo(const Pos xx) |
|
{ Bool top_two; if (xx == FIRST) { top_two = TRUE; } else if (xx == SECOND) { top_two = TRUE; } else { ; } return top_two; |
|
} [/INST] The error is Empty else clause following else if. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define isillegal 11 |
|
SINT_32 total = 12; |
|
SINT_32 static_478(SINT_32 p1) |
|
{ SINT_32 result = total + (p1 * isillegal); return result; |
|
} [/INST] The error is Name starts with ISO reserved prefix (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_479(void) |
|
{ UINT_8 ss = 15U; UINT_8 res; res = ss >> 4U; |
|
} [/INST] The error is Right shift loses all bits. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
void static_480(void) |
|
{ char str[] = {""ABCDEFGHIJKLMNOPQRSTUVWXYZ""}; (void)memcpy(&str[10], &str[13], 6U); |
|
} [/INST] The error is String function params access same variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_481 ( void ) |
|
{ struct static_481_tag { INT_16 a; INT_16 b [ ]; }; struct static_481_tag static_481_st = { 1, { 2, 3, 4 } }; |
|
} [/INST] The error is Array with no bounds in struct. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern struct st *pst1; |
|
extern struct st *pst2; |
|
void static_482 ( void ) |
|
{ pst2 = pst1; *pst2 = *pst1; |
|
} [/INST] The error is Incomplete structure referenced. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct bitfield1 {UINT_32 x:1;}; |
|
void static_42(void) |
|
{ |
|
} [/INST] The error is Use of bit field in structure declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
struct S |
|
{ UINT_32 ac; UINT_32 bc; |
|
}; |
|
void static_483 ( void ) |
|
{ UINT_32 ic; UINT_32 *jc; struct S *sptr; sptr = (struct S*)malloc(sizeof(struct S)); jc = ⁣ free(jc); free(sptr); |
|
} [/INST] The error is Freed parameter is not heap item. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
struct S |
|
{ UINT_32 ac; UINT_32 bc; |
|
}; |
|
void static_484 ( void ) |
|
{ UINT_32 ic; struct S *sptr; sptr = (struct S*)malloc(sizeof(struct S)); free(sptr); ic = sptr->ac; |
|
} [/INST] The error is Attempt to use already freed object. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
void static_486 ( char * my_string ) |
|
{ printf ( my_string ); printf ( ""My string is %s"", my_string ); |
|
} [/INST] The error is Incorrect number of formats in output function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
struct S |
|
{ UINT_32 ac; UINT_32 bc; CHAR cc[100]; |
|
}; |
|
static void static_487 ( void ) |
|
{ UINT_32 tt; struct S *sptr; sptr = (struct S*)malloc(sizeof(sptr)); sptr->ac = 0U; sptr->bc = 0U; tt = sptr->bc; free(sptr); |
|
} [/INST] The error is Insufficient space allocated. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_488 ( void ) |
|
{ SCHAR s8a = 1; SCHAR s8b = 1; s8a = s8a + 126; s8b = s8b + 150; |
|
} [/INST] The error is Value outside range of underlying type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
void static_489 ( void ) |
|
{ char source[200]; char destination[100]; strncpy( destination, source, 200 ); char arr_string[10] = {'a', 'b', 'c'}; char arr_dest[5]; strncpy( arr_dest, arr_string, 5 ); |
|
} [/INST] The error is Insufficient space for operation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern void helper64( FLOAT_64 h1 ); |
|
extern void helper32( FLOAT_32 h2 ); |
|
void static_490( void ) |
|
{ FLOAT_32 s1; helper32(s1); helper64((FLOAT_64)s1); helper64(s1); |
|
} [/INST] The error is No cast for widening float parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern void helper32( UINT_32 h1 ); |
|
extern void helper16( UINT_16 h2 ); |
|
void static_491( void ) |
|
{ UINT_16 s1; helper16(s1); helper32((UINT_32)s1); helper32(s1); |
|
} [/INST] The error is No cast for widening int parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_492( UINT_32 p1, UINT_32 p2, UINT_32 p3, UINT_32 p4 ) |
|
{ |
|
} [/INST] The error is Parameter not declared on new line. </s>" |
|
"<s>[INST] find the error in this code: #include <setjmp.h> |
|
#include ""c_standards.h"" |
|
jmp_buf env; |
|
void static_43 (SINT_32 val) |
|
{ longjmp(env,val); |
|
} [/INST] The error is Use of setjmp/longjmp. </s>" |
|
"<s>[INST] find the error in this code: short s16a, s16b; |
|
s16a + s16b; |
|
3U + s16a; |
|
unsigned char u8a, u8b; |
|
u8a + u8b; |
|
typedef int SIGNED_INT_16; |
|
typedef long SIGNED_LONG_32; |
|
static void static_493( void ) |
|
{ SIGNED_INT_16 s16 = 32767; SIGNED_LONG_32 s32; s32 = s16 + 1; |
|
} [/INST] The error is Numeric overflow. </s>" |
|
"<s>[INST] find the error in this code: typedef unsigned int uint32_t; |
|
typedef int Boolean; |
|
typedef unsigned short my_uint; |
|
typedef uint32_t my_counter; |
|
static void static_495( void ) |
|
{ my_uint local_var; |
|
} [/INST] The error is Typedef name has no size indication. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_496( void ) |
|
{ UINT_32 my_local = 42U; static_496_helper(); |
|
} |
|
static void static_496_helper( SINT_16 p1 ) |
|
{ |
|
} [/INST] The error is Function call with no prior declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_497( void ) |
|
{ struct st s1; |
|
} [/INST] The error is Type is incomplete in translation unit. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_509( const UINT_32 p1 ) |
|
{ UINT_32 xx = 0; |
|
lab1: xx++; if ( p1 > xx ) { goto lab2; } else { goto lab1; } |
|
lab2: xx++; |
|
} [/INST] The error is goto label is backwards. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define MAX_SIZE 10U |
|
void static_510( void ) |
|
{ for ( UINT_32 loop_var = 1U; loop_var != MAX_SIZE; loop_var +=2U ) { ; } |
|
} [/INST] The error is Loop counter increment and operator defect. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define MAX_SIZE 512 |
|
void static_511( UINT_32 p1 ) |
|
{ UINT_32 local = 0U; UINT_32 action = 0U; goto lab1; for(local; local < MAX_SIZE; local++) { |
|
lab1: action += p1; } |
|
} [/INST] The error is Jump into nested block. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct S { int xx : 2; }; |
|
void static_520( void ) |
|
{ struct S st; |
|
} [/INST] The error is Bit field is not bool or explicit integral. </s>" |
|
"<s>[INST] find the error in this code: #include <stdlib.h> |
|
#include ""c_standards.h"" |
|
static void static_530( void ); |
|
static void static_530( void ) |
|
{ UINT_32 xx = 0; if( xx == NULL ){;} |
|
} [/INST] The error is NULL used in integer context. </s>" |
|
"<s>[INST] find the error in this code: #include <stdlib.h> |
|
#include ""c_standards.h"" |
|
static void static_531( void ) |
|
{ UINT_32 * pxx = NULL ; UINT_32 * pxy = ( 4 - 4 ); if( pxx == 0 ) {;} |
|
} [/INST] The error is Literal zero used in pointer context. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdarg.h> |
|
void static_44( CHAR* p_1,...) |
|
{ va_list ap; CHAR* t; va_start(ap, p_1); t = va_arg(ap, CHAR*); va_end(ap); |
|
} [/INST] The error is Use of banned function, type or variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef enum { aa, bb } enum_536; |
|
struct tag |
|
{ enum_536 a:4; |
|
}; |
|
void static_536( void ) |
|
{ ; |
|
} [/INST] The error is Enum type in bit field. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static UINT_32 test ( UINT_32 *v ) { *v = *v + 1U; return ( *v < 10U ); } |
|
static void static_537( void ) |
|
{ UINT_32 bool_a = FALSE; UINT_32 x; for ( x = 0U; ( x < 10U ) && test ( & bool_a ); ++x ) { ; } |
|
} [/INST] The error is Extra loop control variable changed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_542 ( void ) |
|
{ INT_32 x = 0; INT_32 y = 0; for (x = 0; (x < 10) && (y != 21); x++, y++) { ; } |
|
} [/INST] The error is Extra loop control variable is not bool. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_550( void ) |
|
{ UINT_32 xx; xx = 0x8ff7ffff ; |
|
} [/INST] The error is Unsuffixed hex or octal is unsigned, add U. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_553( void ); |
|
void static_553( void ) |
|
{ ; |
|
} [/INST] The error is Function and proto should both be static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct tag1 |
|
{ UINT_16 u16; |
|
}; |
|
struct tag2 |
|
{ UINT_32 u32; |
|
}; |
|
static void static_554( void ) |
|
{ signed char *pc8; struct tag1 *st1; struct tag2 *st2; st2 = (struct tag2 *)(st1); (void)st1; pc8 = (signed char*)st1; |
|
} [/INST] The error is Cast to an unrelated type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_16 global = 0U; |
|
UINT_16 init_glob( UINT_16 ui ) |
|
{ global = ui; return ui; |
|
} |
|
static void static_560( void ) |
|
{ UINT_16 us; UINT_16 usx = init_glob(3U); if( global > 1U ) { us = 78U; usx = 0U; } |
|
} [/INST] The error is Scope of variable could be reduced. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_562( void ); |
|
#define MAC( x ) x + 10 |
|
static void static_562( void ) |
|
{ INT_16 aa = 1; MAC ( aa++ ); |
|
} [/INST] The error is Use of ++,-- or = in macro parameters. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct tag |
|
{ UCHAR ff; |
|
}; |
|
struct tag *uglob; |
|
static void static_565( void ) |
|
{ static struct tag avar; uglob = & avar; |
|
} [/INST] The error is Assignment to wider scope. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_567( UINT_32 * pp ); |
|
static void static_567( UINT_32 * pp ) |
|
{ UINT_32 * xx; xx = pp +7; |
|
} [/INST] The error is Pointer arithmetic is not on array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_5(void) |
|
{ UINT_32 value_x = 1u; if (value_x == 0u) { |
|
#if FALSE value_x = value_x + 1u; |
|
#endif } if (value_x == 0u) {;} |
|
} [/INST] The error is Empty then clause. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_45(void) |
|
{ UINT_32 public = 0; UINT_32 private = 0; UINT_32 protected = 0; UINT_32 operator = 0; UINT_32 new = 0; UINT_32 template = 0; UINT_32 virtual = 0; UINT_32 delete = 0; UINT_32 friend = 0; UINT_32 cout = 0; UINT_32 cin = 0; UINT_32 endl = 0; |
|
} [/INST] The error is Use of C++ keyword. </s>" |
|
"<s>[INST] find the error in this code: void static_568( void ) |
|
{ |
|
#include ""stdlib.h"" |
|
} [/INST] The error is #include ""filename"" uses standard library name. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_572( void ); |
|
static void static_572( void ) |
|
{ UCHAR xx = 99; assert( xx = 91); |
|
} [/INST] The error is Side effect in assert. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define makename(uc1, uc2, uc3, uc4) uc1##uc2##uc3##uc4 |
|
static void static_573( void ) |
|
{ makename ( \U00010401, \U00010401, \U00010401, \U00010402 ) = 4; |
|
} [/INST] The error is Macro concatenation of uni char names. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_575( void ); |
|
static INT_32 DCL36_i2 = 20; |
|
INT_32 DCL36_i2; |
|
static void static_575( void ) |
|
{ |
|
} [/INST] The error is Linkage differs from previous declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_576( void ); |
|
typedef void (*fptr1)(void); |
|
typedef UCHAR (*fptr2)(UCHAR uc); |
|
static void static_576( void ) |
|
{ fptr1 afp; fptr2 bfp; afp = bfp; |
|
} [/INST] The error is Function pointer is of wrong type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_577( void ); |
|
UCHAR * puc; |
|
static void static_577( void ) |
|
{ UCHAR xx; xx = sizeof(puc) ; |
|
} [/INST] The error is Sizeof argument is a pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_578( void ); |
|
UCHAR xx; |
|
static void static_578( void ) |
|
{ xx = sizeof(xx) + 10U; |
|
} [/INST] The error is Sizeof used in arithmetic expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct astr { UCHAR f1; SCHAR f2; |
|
} okstr1,notokstr2; |
|
struct astr okstruct1; |
|
struct astr okstruct2,notokstruct1; |
|
UCHAR global_ok1; |
|
UCHAR global_ok2,gobal_notok1; |
|
static void static_579( void ) |
|
{ UINT_32 local_ok1; UINT_32 localnok_ok1, localnot_ok2; |
|
} [/INST] The error is More than one variable per declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define WHAT static |
|
#define WHAT volatile |
|
INT_16 xx = 9; |
|
#define OK static |
|
#undef OK |
|
#define OK static |
|
static void static_580( void ) |
|
{ ; |
|
} [/INST] The error is Macro redefinition without using #undef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_581( void ); |
|
INT_32 endcond ( void ) |
|
{ return 1; |
|
} |
|
static void static_581( void ) |
|
{ INT_32 ii = 0; INT_32 data[10]; INT_32 end = 0; for ( ii=0; ( ii < 10 ) || ( !end ) ; ii++ ) { data[ii] = ii; if ( endcond() != 0 ) { end = 1; } } |
|
} [/INST] The error is Loop conditions are independent. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_582( const UINT_16 * par1 ) |
|
{ const char * str; str = ""ok""; *str = 'A'; *(str + 1) = 'B'; str = ""ABC""; *par1 = 78U; |
|
} [/INST] The error is const object reassigned. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_583( void ); |
|
static void static_583( void ) |
|
{ CHAR * str; str = ""def"" ; if ( str == ""def"" ) { } |
|
} [/INST] The error is Comparison of pointer and string literal. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_584( void ); |
|
INT_16 ss = 0; |
|
static void static_584( void ) |
|
{ INT_16 rem; rem = ss % 4; |
|
} [/INST] The error is Remainder of % op could be negative. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void static_585( void ); |
|
typedef enum |
|
{ shift = 2U, mask = 0x10U, part = 1U |
|
} constants; |
|
static void static_585( void ) |
|
{ UINT_32 a = ( getchar () == EOF ) ? 50U : 100U; volatile UINT_32 r; r = a + ( a << shift ) + part; |
|
} [/INST] The error is Bitwise and arith operations on same data. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_586( void ) |
|
{ typedef signed long long long s_t; s_t s; if ( scanf ( ""%lld"" , & s ) != 1 ) { (void) printf ( ""*"" ); } |
|
} [/INST] The error is Format is not %j for user defined type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_587( void ); |
|
static void static_587( void ) |
|
{ const INT_32 loc; loc = 0; INT_32 rr = loc; |
|
} [/INST] The error is Const local variable not immediately initialised. </s>" |
|
"<s>[INST] find the error in this code: #include <stdlib.h> |
|
static void static_588( void ); |
|
static void static_588( void ) |
|
{ system("" wow"" ); |
|
} [/INST] The error is Use of system function. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_589( void ) |
|
{ int x = 7; float ff = 8.9F; unsigned u = 9U; char * ss = ""oh my"" ; (void) printf("" \n %d "", u); (void) printf("" \n %d "", ff); (void) printf("" \n %s "", x); (void) printf("" \n %d "", ss); |
|
} [/INST] The error is Format is not appropriate type. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_590( void ) |
|
{ fopen(""afile1.h"" , ""wb+"" ); fopen(""afile2.h"" , ""c"" ); |
|
} [/INST] The error is Mode fault in fopen. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_591( void ); |
|
FILE file_f; |
|
FILE file_g; |
|
FILE * hptr; |
|
FILE * iptr; |
|
static void static_591( void ) |
|
{ hptr = fopen("" afile.h"" ,"" w"" ); iptr = hptr; file_f = *hptr; file_g = file_f; |
|
} [/INST] The error is Inappropriate use of file pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""Static_46.h"" |
|
void static_46(void) |
|
{ undef_global = 1U; |
|
} [/INST] The error is extern not in nominated include file. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_592( void ); |
|
static void static_592( void ) |
|
{ (void) remove("" afile.h"" ); (void) rename("" afile.h"" , ""bfile.h"" ); |
|
} [/INST] The error is Use of filename based functions. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_593( void ); |
|
static void static_593( void ) |
|
{ FILE *fptr = fopen("" afile.h"" ,"" r"" ); rewind(fptr); |
|
} [/INST] The error is Use fseek() rather than rewind(). </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
static void static_594( void ); |
|
static void static_594( void ) |
|
{ FILE *fptr = fopen("" afile.h"" ,"" w"" ); setbuf(fptr, NULL); |
|
} [/INST] The error is Use setvbuf() rather than setbuf(). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_598( const UINT_32 val ) |
|
{ UINT_32 data[2]; 1U[data] = val; return 1U[data]; |
|
} [/INST] The error is Alternative array indexing used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define a 77U |
|
#define b 32U |
|
UINT_32 arr[4]= { a | b, a || b, a && b, a & b }; [/INST] The error is Use of && or || in initialisation. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
#include ""c_standards.h"" |
|
void static_600( void ) |
|
{ SINT_32 xx; char arr [3] = { 'a', 'b', 'c' }; xx = strlen(arr); |
|
} [/INST] The error is Argument of strlen is unterminated. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
void STATIC_602 ( void ) |
|
{ char *token; char *path = ""/usr/bin:/bin:/sbin""; token = strtok ( path, "":"" ); while ( token = strtok ( 0, "":"" ) ) { ; } |
|
} [/INST] The error is strtok may change the parse string. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 global; |
|
void static_603 ( SINT_32 * ptr1, SINT_32 * const ptr2, SINT_32 * ptr3 ) |
|
{ *ptr1 = global; *ptr2 = global; ptr3 = &global; |
|
} [/INST] The error is Parameter should be declared * const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum { LIMIT = 100 }; |
|
#define ARRAY_SIZE 100 |
|
void static_604( void ) |
|
{ SINT_32 array_ok1[ARRAY_SIZE]; SINT_32 array_ok2[LIMIT]; SINT_32 array_nok[100]; SINT_32 *ptr = &array_ok1[0]; array_nok[99] = 3; |
|
} [/INST] The error is Use of numeric literal as array bound/subscript. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_605(void) |
|
{ long long llvar = 3LL; |
|
} [/INST] The error is Use of long long. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_047(void) |
|
{ SINT_32 array[5] = {0,0,0,0,0}; SINT_32 *ptr; array[5] = 1; ptr = &array[5]; ptr = &array[6]; |
|
} [/INST] The error is Array bound exceeded. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef INT_32 (* fptr) (INT_32 p); |
|
void myProc(UINT_32 x) |
|
{ |
|
} |
|
void static_606 ( UINT_32 u, fptr fp ) |
|
{ fp = (fptr) & myProc; fp = (fptr) & u; fp = (fptr)0; (void) & myProc; |
|
} [/INST] The error is Cast involving function pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_607(void) |
|
{ UINT_32 x = 1; if (!!(x == 1)) { x = 2; } else if (!!!(x == 2)) { x = 1; } if (!!!!(x == 1)) { x = 2; } |
|
} [/INST] The error is Double negative found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_608( void ) |
|
{ INT_32 i = 3 u; |
|
} [/INST] The error is Use of explicitly undefined language feature. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
#define DEBUG /##/ |
|
void static_609() |
|
{ DEBUG comment on debug code (void)printf(""debug print""); |
|
} [/INST] The error is Use of implicitly undefined language feature. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_610(void) |
|
{ INT_16 x = 6; |
|
label1: x = 0; |
|
} [/INST] The error is Label is unused. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_611(BOOL test) |
|
{ INT_32 x = 0; if (test) { x = 10; } |
|
} [/INST] The error is Line splice used in |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 count = 1; |
|
inline void static_612 (void) |
|
{ count++; |
|
} [/INST] The error is inline function should be declared static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_613 (INT_32 * restrict p, const INT_32 *q ) |
|
{ *p = *q; |
|
} [/INST] The error is Use of restrict keyword. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_614 ( INT_16 a [ static 20 ] ) |
|
{ ; |
|
} [/INST] The error is Use of static keyword in array parameter. </s>" |
|
"<s>[INST] find the error in this code: void static_615(int which) |
|
{ void *x; union { int i; double d; } u; u.i = 1; x = which ? &u.i : &u.d; |
|
} [/INST] The error is Conditional operator has incompatible types. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_48(SINT_32 p_1) |
|
{ SINT_32 i = 0, j = 0; switch (p_1) { case 0: j = 0; break; case 1: j=i; break; } |
|
} [/INST] The error is No default case in switch statement. </s>" |
|
"<s>[INST] find the error in this code: #define ONE 1 |
|
#define ZERO 0 |
|
#if ONE |
|
int ok1; |
|
#elif ZERO |
|
int ok2; |
|
#elif 0 |
|
int ok3; |
|
#elif 1 |
|
int ok4; |
|
#elif ONE |
|
int ok5; |
|
#endif |
|
#if ZERO |
|
int ok6; |
|
#endif |
|
#if 0 |
|
int ok7; |
|
#endif |
|
#if 1 |
|
int ok8; |
|
#endif |
|
#if ONE + ZERO |
|
int ok9; |
|
#endif |
|
#if 7449 - 7000 - 448 |
|
int ok10; |
|
#endif |
|
#if 2 |
|
int duff1; |
|
#endif |
|
#if -1 |
|
int duff2; |
|
#endif |
|
void static_616(void) |
|
{ |
|
} [/INST] The error is Preprocessor result not 0 or 1. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 func_not_ok(void) |
|
{ return; |
|
} |
|
void static_617(void) |
|
{ UINT_32 i = func_not_ok(); |
|
} [/INST] The error is Function call may return unexpected value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
struct struct_a |
|
{ UINT_32 value; |
|
}; |
|
void static_618(void) |
|
{ struct struct_a s1 = {10}; struct struct_a s2 = {10}; BOOL test = memcmp(&s1, &s2, sizeof(struct struct_a)); |
|
} [/INST] The error is Use of memcmp between structures. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 fnA ( void ) |
|
{ return 1; |
|
} |
|
void static_619 ( void ) |
|
{ if (fnA == 0) { ; } if ( fnA ) { ; } |
|
} [/INST] The error is Function address compared with zero or NULL. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct enddate { INT_32 year; INT_32 month; INT_32 day; }; |
|
void static_620(void) |
|
{ INT_32 a3[4] = { [0] = -5, [1] = -4, [2] = -3, [2] = -2 }; struct enddate last = { .year = 2012, .month = 12, .year = 2000 }; |
|
} [/INST] The error is Initialisation designator duplicated. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_621 (UINT_32 n) |
|
{ INT_32 vla [ n ]; |
|
} [/INST] The error is Variable-length array declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define M( this_is_a_parameter_of_macro_m_first, this_is_a_parameter_of_macro_m_second ) \ ((this_is_a_parameter_of_macro_m_first) +(this_is_a_parameter_of_macro_m_second)) |
|
#define M2(this_is_a_parameter_of_macro_m2_this_is_a_parameter_of_macro_m2_first, \ this_is_a_parameter_of_macro_m2_this_is_a_parameter_of_macro_m2_second) \ ((this_is_a_parameter_of_macro_m2_this_is_a_parameter_of_macro_m2_first) + \ (this_is_a_parameter_of_macro_m2_this_is_a_parameter_of_macro_m2_second)) |
|
static UINT_32 static_622( void ) |
|
{ return M ( 3U, 5U ) + M2 ( 3U, 5U ); |
|
} [/INST] The error is Macro parameters are not unique within limits. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
CHAR * return_string(void) |
|
{ return ""fred""; |
|
} |
|
void static_623(void) |
|
{ CHAR * string_test = ""test""; |
|
} [/INST] The error is String assigned to non const object. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define int UINT_32 |
|
void static_626(void) |
|
{ |
|
} [/INST] The error is #define of keyword. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_627(void) |
|
{ INT_32 a1[2][2] = {{0}, [1][0] = 0, 1}; INT_32 a2[2][2] = {[0][1] = 0, {0, 1}}; |
|
} [/INST] The error is Initialiser both positional and designational. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern BOOL get_bool ( void ); |
|
void static_49(void) |
|
{ BOOL flag = TRUE; INT_32 y = 0, x = 0, z = 1; if (x < 0 || z + y != 0) { flag = FALSE; } if ( flag && get_bool() ) { flag = FALSE; } |
|
} [/INST] The error is Logical conjunctions need brackets. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define SIZE_USED 6 |
|
#define DATA 3 |
|
INT_32 static_628(void) |
|
{ |
|
#define SIZE_NOT_USED 6 |
|
return SIZE_USED; |
|
} [/INST] The error is Macro not used in translation unit. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_629( void ) |
|
{ SINT_32 local_denominator = 1; SINT_32 numerator = 9; SINT_32 result = numerator / ( local_denominator - 1 ); |
|
} [/INST] The error is Divide by zero found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_630(void) |
|
{ enum traffic{ red=3, amber, green, yellow=4 }; enum traffic_ok{ Xred=3, Xamber=4, Xgreen, Xyellow=4 }; |
|
} [/INST] The error is Duplicated enumeration value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_16 static_631( void ) |
|
{ goto L1; UINT_16 x = 10U; L1: x = x + 1U; return x; UINT_16 y = 0U; |
|
} [/INST] The error is Declaration not reachable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define SQ_2 (2*2) |
|
INT_32 static_632(void) |
|
{ return SQ_2; |
|
} [/INST] The error is Use of |
|
"<s>[INST] find the error in this code: #include <wincrypt.h> |
|
void static_633(HCRYPTPROV hProv, HCRYPTHASH hHash, HCRYPTKEY *hKey) |
|
{ CryptDeriveKey(hProv, CALG_3DES, hHash, CRYPT_EXPORTABLE, hKey); |
|
} [/INST] The error is Use of a broken or risky cryptography algorithm. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_634 (UINT_32 name_x) |
|
{ UINT_32 count = 0u; if (name_x == 0u) { count = 1u; } else { } for ( count; count < 10u; count++ ) { ; } { } |
|
} [/INST] The error is Empty block found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_635 (FLOAT_32 *f_ptr) |
|
{ FLOAT_32 ss = (FLOAT_32)f_ptr; |
|
} [/INST] The error is Cast from pointer to float type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_636 ( void ) |
|
{ void *p = (void*) 3.4f; |
|
} [/INST] The error is Cast from float type to pointer. </s>" |
|
"<s>[INST] find the error in this code: #define JOIN( x, y ) #x ## y |
|
void static_637(void) |
|
{ const char *name = JOIN (Control, 1 ); |
|
} [/INST] The error is # operand followed by ##. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_50(void) |
|
{ SINT_32 b = 1; b >>= 1; |
|
} [/INST] The error is Use of shift operator on signed type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
typedef struct { INT_32 a; INT_32 b; } struct_2int; |
|
static void static_638 ( void ) |
|
{ INT_32 * ptr1 = malloc(5); INT_32 * ptr2 = malloc(32); struct_2int *ptr3 = malloc(5); struct_2int *ptr4 = malloc(32); struct_2int *ptr5 = malloc(4*sizeof(struct_2int)); |
|
} [/INST] The error is Memory allocation non-conformant with type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_639( void ) |
|
{ UINT_32 name_x = 1u; if(name_x == 0u) { } { } |
|
} [/INST] The error is Potentially missing else statement. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
struct a_str |
|
{ char text[6]; |
|
}; |
|
static struct a_str get_text(void) |
|
{ struct a_str result = {""world""}; return result; |
|
} |
|
void static_642(void) |
|
{ struct a_str my_str = get_text(); printf(""Hello, %s!\n"", my_str.text); printf(""Hello, %s!\n"", get_text().text); |
|
} [/INST] The error is Function return type with array field. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <errno.h> |
|
static SINT_32 fn1 (void) |
|
{ return (errno); |
|
} |
|
static SINT_32 static_643 (void) |
|
{ return (EIO); |
|
} [/INST] The error is Function return type is not errno_t. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
typedef struct astr |
|
{ char ch; int ii; |
|
} astr; |
|
void static_644 (void) |
|
{ astr str; astr *ptr1 = (astr*)malloc(10 * sizeof(astr)); astr *ptr2 = NULL; astr *ptr3 = &str; ptr1 = (astr*)realloc(ptr1, 20 * sizeof(astr)); ptr2 = (astr*)realloc(ptr2, 6 * sizeof(astr)); ptr3 = (astr*)realloc(ptr3, 8 * sizeof(astr)); |
|
} [/INST] The error is realloc ptr does not originate from allocation function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
typedef struct atag |
|
{ char ach; FLOAT_32 afl; |
|
} str1_t; |
|
typedef struct btag |
|
{ SINT_64 ll; SINT_16 *pp; char cc; |
|
} str2_t; |
|
str1_t * astr; |
|
static void static_645( void ) |
|
{ str1_t *past = (str1_t*) malloc(sizeof(str1_t)); str2_t *qast = (str2_t*) realloc(past, sizeof(str2_t)); |
|
} [/INST] The error is realloc ptr type does not match target type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct tag { SINT_16 ss; FLOAT_32 ff; }; |
|
static void static_646( void ) |
|
{ struct tag astruct = { 3, 7.1F, 7 }; |
|
} [/INST] The error is Struct initialisation has too many items. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
int array[30]; |
|
static void static_647( void ) |
|
{ memcpy( array, array, 20); |
|
} [/INST] The error is Overlapping data items in memcpy. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_648 ( void ) |
|
{ struct { INT_32 i1; INT_32 arr1[0]; } astruct1; struct { INT_32 i2; INT_32 arr2[1]; } astruct2; struct { INT_32 i3; INT_32 arr3[]; } astruct3; |
|
} [/INST] The error is Deprecated form of flexible array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct flex { INT_16 size; INT_16 arr[]; }; |
|
static void static_649( void ) |
|
{ struct flex flexarr; flexarr.size = 10; flexarr.arr[9] = 99; |
|
} [/INST] The error is Use of unallocated flexible array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_51(void) |
|
{ UINT_32 x = 0u; UINT_32 y = 2u; x = y << 34u; x = 4u << 10u; |
|
} [/INST] The error is Shifting value too far. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
struct flex { INT_16 num; INT_16 data[]; |
|
}; |
|
static void static_650( void ) |
|
{ struct flex *parr1; struct flex *parr2; parr1 = (struct flex*) malloc(sizeof(struct flex)+ (sizeof(int)*40)); (*parr1).num = 40; parr2 = (struct flex*) malloc(sizeof(struct flex)+ (sizeof(int)*40)); (*parr2).num = 40; *parr1 = *parr2; |
|
} [/INST] The error is Flexible array copy ignores last member. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
#include <stdlib.h> |
|
static char static_652( void ) |
|
{ char res; char *cptr = (char*)malloc(sizeof(char)*7); char *dptr = (char*)malloc(sizeof(char)*7); char src[7] = ""abcdef""; strcpy(cptr, src); res = cptr[3]; res = dptr[3]; return res; |
|
} [/INST] The error is Object created by malloc used before initialisation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define GEN(x) _Generic( x, int : 1, default : 72 ) |
|
static void static_653( void ) |
|
{ SINT_32 y = 66; SINT_32 avar = GEN(y++); SINT_32 bvar = GEN(y); |
|
} [/INST] The error is Apparent side effects in _Generic or _Alignof. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
union u1 |
|
{ INT_32 i1 ; INT_32 arr1[]; |
|
}; |
|
union u2 |
|
{ INT_32 i2; INT_32 arr2[0]; |
|
}; [/INST] The error is Union contains flexible array. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
struct struct_a |
|
{ UINT_32 value; |
|
}; |
|
static void static_655( void ) |
|
{ struct struct_a s1 = {10U}; UINT_32 b32 = 1U; BOOL test = memcmp(&s1, &b32, sizeof(struct struct_a)); |
|
} [/INST] The error is Standard library copy/compare objects have different types. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define SIZE 3 |
|
SINT_32 global = SIZE > 0 ? 10 : 1; |
|
SINT_32 static_656(void) |
|
{ return global; |
|
} [/INST] The error is Use of ternary expression within global initialisation. </s>" |
|
"<s>[INST] find the error in this code: #include <string.h> |
|
void static_661(void) |
|
{ char buffer1[12] = ""abc""; char buffer2[12] = ""abc""; if ( memcmp ( buffer1, buffer2, 9 ) != 0 ) { } |
|
} [/INST] The error is memcmp used to compare null terminated strings. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
void static_662(void) |
|
{ char ch; ch = ( char ) getchar( ); if ( EOF != ( INT_32 ) ch ) { ; } |
|
} [/INST] The error is EOF compared with char. </s>" |
|
"<s>[INST] find the error in this code: #include <ctype.h> |
|
void static_663(void) |
|
{ if ( isalpha ( 256 ) != 0 ) { ; } |
|
} [/INST] The error is Invalid value may be passed to function in <ctype.h>. </s>" |
|
"<s>[INST] find the error in this code: typedef long double FLOAT_LD; |
|
void static_672(void) |
|
{ long double ld1 = 1.1L; |
|
} [/INST] The error is long double is not permitted. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_52(void) |
|
{ UINT_32 x = 1u; UINT_32 y = 2u; y = -x; |
|
} [/INST] The error is Unsigned expression negated. </s>" |
|
"<s>[INST] find the error in this code: void static_674(void) |
|
{ wchar_t a_wide_char; |
|
} [/INST] The error is wchar_t is not permitted. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
int typedef Length_32; |
|
void static_678( void ) |
|
{ FLOAT_32 static fx; |
|
} [/INST] The error is Type specifier before non-type specifier. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define VALUE 0 |
|
#if VALUE < 10 |
|
#error ""Incorrect value"" |
|
#endif |
|
void static_681( void ) |
|
{ ; |
|
} [/INST] The error is #error directive used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_687 ( void ) |
|
{ UINT_32 arr[3] = { 1U, 2U, 3U }; INT_32 i; for ( i = 50; arr[i] != 0U; i-- ) { ; } for ( i = 50; (i >= 0) && (arr[i] != 0U) ; i-- ) { ; } |
|
} [/INST] The error is Loop counter not checked for negative value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void static_688 ( void ) |
|
{ char * cptr = (char *)malloc(2000); INT_32 * iptr = (INT_32 *)malloc(5000000); |
|
} [/INST] The error is Memory allocation exceeds 2 power *** bytes. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" void static_691( void ) { INT_32 *c = { 0 }; INT_32 *nc = { 1, 2, 3, 4, 5 }; } [/INST] The error is Initialisation of pointer with initialiser list. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_692(void) |
|
{ SINT_32 array[5] = {0,0,0,0,0}; SINT_32 value = -1; array[value] = 1; |
|
} [/INST] The error is Array index is negative. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_693(FLOAT_64 f64) |
|
{ FLOAT_32 f32; f32 = (FLOAT_32)f64; |
|
} [/INST] The error is Float expression cast to narrower float type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_694(SINT_64 s64) |
|
{ SINT_32 s32; s32 = (SINT_32)s64; |
|
} [/INST] The error is Integer expression cast to narrower integer type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_695(char ch) |
|
{ SINT_32 s32; FLOAT_32 f32; s32 = (SINT_32)ch; f32 = (FLOAT_32)ch; |
|
} [/INST] The error is Char expression cast to non-char type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 foo( UINT_32 v_1 ) |
|
{ return (v_1+1); |
|
} |
|
void static_53(void) |
|
{ UINT_32 x = 1u; x++ , foo(x) ; |
|
} [/INST] The error is Bool expression cast to non-bool type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_695(BOOL bl) |
|
{ SINT_32 s32; s32 = (SINT_32)bl; |
|
} [/INST] The error is Char expression cast to non-char type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_697(SINT_64 *ps64, void* pany) |
|
{ SINT_32 *ps32; ps32 = ps64; ps32 = pany; ps32 = (void*)0; |
|
} [/INST] The error is Pointer converted to different pointer type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern void use_with_care_proc ( void ); |
|
void static_698( void ) |
|
{ use_with_care_proc( ); |
|
} [/INST] The error is Potential improper use of function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define LOOP_N(n) for ( i = 0; i <(n); i++ ); |
|
void static_699( void ) |
|
{ SINT_32 count = 0; LOOP_N(10) { count ++; } |
|
} [/INST] The error is Macro terminated with semi-colon. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct mydata { SINT_32 x; SINT_32 y; }; |
|
void static_700(SINT_64 value) |
|
{ struct mydata info; info = (struct mydata)value; |
|
} [/INST] The error is Cast involving structure type. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_701(SINT_32 *ptr) |
|
{ void * pv; pv = (void *)ptr; |
|
} [/INST] The error is Pointer cast to pointer to void. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_702(SINT_32 *ptr) |
|
{ const SINT_32 * pc; pc = (const SINT_32 *)ptr; |
|
} [/INST] The error is Cast adds qualification. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void LDRA_704(UINT_32 par_1, UINT_32 par_2) |
|
{ UINT_32 x = 0; x = (par_1 || par_2); x = (par_1 && par_2); x = ( ( par_1 && par_2 ) ? 1 : 0); x = ( ( par_1 == par_2 ) ? 1 : 0); x = (par_1 != par_2); x = (par_1 == par_2); x = (par_1 > par_2); x = (par_1 < par_2); x = (par_1 <= par_2); x = (par_1 >= par_2); x = (par_1 >= 0); |
|
} [/INST] The error is Assignment statement with boolean relational operator. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL isHexDigit( CHAR Hex ) |
|
{ BOOL bResult; bResult = FALSE; if ((Hex == '0') || (Hex == '1') || (Hex == '2') || (Hex == '3') || (Hex == '4') || (Hex == '5') || (Hex == '6') || (Hex == '7') || (Hex == '8') || (Hex == '9') || (Hex == 'A') || (Hex == 'a') || (Hex == 'B') || (Hex == 'b') || (Hex == 'C') || (Hex == 'c') || (Hex == 'D') || (Hex == 'd') || (Hex == 'E') || (Hex == 'e') || (Hex == 'F') || (Hex == 'f')) { bResult = TRUE; } return bResult; |
|
} [/INST] The error is Procedure exceeds *** reformatted lines. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void complex_2_3 ( BOOL c_1, BOOL c_2 ) |
|
{ if (c_1) { |
|
label1: ; } if (c_2) { goto label1; } |
|
} [/INST] The error is Procedure contains essential knots. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 p_1, UINT_16 p_2) |
|
{ } |
|
void static_6(void) |
|
{ void (*proc_pointer) (UINT_32 p_1, UINT_16 p_2) = foo; proc_pointer(1u, 1); |
|
} [/INST] The error is Procedure pointer declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_54(void) |
|
{ UINT_32 x = 1u; UINT_32 a = 1u; a = sizeof( x++ ); |
|
} [/INST] The error is Sizeof operator with side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void complex_4 ( BOOL c_3, BOOL c_4 ) |
|
{ |
|
label1: if (c_3) { if (c_4) { goto label1; } } |
|
} [/INST] The error is Procedure is not structured. </s>" |
|
"<s>[INST] find the error in this code: void complex_5 ( void ) |
|
{ |
|
label1: goto label1; |
|
} [/INST] The error is Procedure contains infinite loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 complex_7 (INT_32 status) |
|
{ if ( status == 0 ) { return 1; } return 2; |
|
} [/INST] The error is Procedure has more than one exit point. </s>" |
|
"<s>[INST] find the error in this code: #define MAX_NUM 10 |
|
int arr[ MAX_NUM ]; |
|
void C_009( void ) |
|
{ int sub; for ( sub = 0; sub < MAX_NUM; sub++ ) { if ( arr[ sub ] == 0 ) { break; } if ( arr[ sub ] == 1 ) { break; } } |
|
} [/INST] The error is Ess Cyclomatic Complexity greater than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void complex_10 ( UINT_32 ee, UINT_32 ff, UINT_32 gg, UINT_32 hh) |
|
{ UINT_32 aa, bb, cc, dd; for (aa = 1U; aa < ee; aa++) { for (bb = aa; bb < ff; bb++) { for (cc = bb; cc < gg; cc++) { for (dd = cc; dd < hh; dd++) { } } } } |
|
} [/INST] The error is Loop depth greater than ***. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void complex_11 ( UINT_32 zz ) |
|
{ UINT_32 aa, bb, cc, dd, ee, ff, gg, hh, ii, jj, kk; for (aa = 1U; aa < zz; aa++) { } for (bb = 1U; bb < zz; bb++) { } for (cc = 1U; cc < zz; cc++) { } for (dd = 1U; dd < zz; dd++) { } for (ee = 1U; ee < zz; ee++) { } for (ff = 1U; ff < zz; ff++) { } for (gg = 1U; gg < zz; gg++) { } for (hh = 1U; hh < zz; hh++) { } for (ii = 1U; ii < zz; ii++) { } for (jj = 1U; jj < zz; jj++) { } for (kk = 1U; kk < zz; kk++) { } |
|
} [/INST] The error is More than *** depth 1 loops. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_001( UINT_32 p_1, UINT_32 p_2 ) |
|
{ UINT_32 v_1; v_1 = p_1; v_1++; return v_1; |
|
} [/INST] The error is Unused procedure parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 SDA_002( INT_32 par_1 ) |
|
{ if ( par_1 == 0 ) { return 0; } else if ( par_1 == 1 ) { return ; } else { ; } |
|
} [/INST] The error is Function does not return a value on all paths. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 glob1 = 1; |
|
static void fn( UINT_32 *par_1 ) |
|
{ *par_1 = *par_1 + glob1++; |
|
} |
|
static void SDA_003(void) |
|
{ fn(&glob1); |
|
} [/INST] The error is Actual parameter is also global to procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static UINT_32 SDA_004( void ) |
|
{ UINT_32 v_1, v_2; v_1 = 0U; return v_1; |
|
} [/INST] The error is Variables declared but not used in code analysed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 exp_1(UINT_32 *p_1) |
|
{ UINT_32 x = *p_1; (*p_1) = x*x; return (x); |
|
} |
|
UINT_32 exp_2(UINT_32 *p_1) |
|
{ UINT_32 x = *p_1; (*p_1) = (x % 2u); return (x); |
|
} |
|
void static_55(void) |
|
{ UINT_32 y = 3u, x = 0u; x = exp_1(&y) + exp_2(&y); |
|
} [/INST] The error is Expression with more than one function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_005 ( void) ; |
|
UINT_32 SDA_005 ( void) |
|
{ UINT_32 v_1 , v_2 ; v_1 = v_2 ; v_2 = v_1 ; return v_2 ; |
|
} [/INST] The error is UR data flow anomalies found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_006( UINT_32 par_a ) |
|
{ UINT_32 result; UINT_32 value; if (par_a != 1 ) { value = par_a; value--; result = SDA_006( value ) * par_a; } else { result=1u; } return (result); |
|
} |
|
UINT_32 Test_006(void) |
|
{ UINT_32 result; result = SDA_006( 20 ); return result; |
|
} [/INST] The error is Recursion in procedure calls found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_007( void ) |
|
{ BOOL flag = FALSE; |
|
} [/INST] The error is DU data flow anomalies found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static BOOL SDA_008( void ) |
|
{ BOOL flag; flag = FALSE; flag = TRUE; return flag; |
|
} |
|
static BOOL SDA_008_1( void ) |
|
{ BOOL flag = FALSE; flag = TRUE; return flag; |
|
} [/INST] The error is DD data flow anomalies found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 *glob_ptr; |
|
void SDA_009(SINT_32 x_1, SINT_32* ptr_1, SINT_32* ptr_2, SINT_32 *ptr_3 ) |
|
{ *glob_ptr = *ptr_2; if (x_1 != 5) { *ptr_1 = x_1 + 6; *ptr_2 = x_1 + 6; ptr_3 = glob_ptr; } |
|
} [/INST] The error is Defined parameter has possible clear path. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 globl = 1U; |
|
void direct_access1( UINT_32 * par_1 ) |
|
{ *par_1 = *par_1 + globl; |
|
} |
|
void indirect_access(void) |
|
{ UINT_32 local_var = 42U; direct_access1(&local_var); |
|
} |
|
static void SDA_010(void) |
|
{ indirect_access(); |
|
} [/INST] The error is Globals used inside procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_011( UINT_32 par_1, UINT_32 par_2 ) |
|
{ if (par_2 != 1U) { par_1 = 0U; } else { par_1= 1U; } |
|
} [/INST] The error is Parameters do not match expected actions. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_012( UINT_32 par_1, UINT_32 par_2 ) |
|
{ UINT_32 var_1; var_1 = par_2; if (par_2 != 1) { var_1 = par_1; } return (var_1); |
|
} [/INST] The error is Referenced parameter has possible clear path. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 globl = 1; |
|
void fn_13( INT_32 * pVar ) |
|
{ *pVar = *pVar + globl; |
|
} |
|
void SDA_013( INT_32 * globl ) |
|
{ fn_13( globl ); |
|
} [/INST] The error is Global used in procedure matches local parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_014( UINT_32 par_1, UINT_32 par_2 ) |
|
{ if (par_2 != 1U) { par_1 = 0U; } else { par_1= 1U; } |
|
} [/INST] The error is Attempt to change parameter passed by value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_56 ( void) |
|
{ FLOAT_32 fl, f2; fl = 1.01f; f2 = 2.01f; if (fl == f2) { } if (fl >= 0.0f) { fl = fl + 0.01f; } |
|
} [/INST] The error is Equality comparison of floating point. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_015(void (*p_proc_pointer)(void) ) |
|
{ |
|
} [/INST] The error is Unused procedural parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void Test_016( UINT_32 *par_1, UINT_32 *par_2 ) |
|
{ if (par_1 == par_2) { } |
|
} |
|
static void SDA_016(void) |
|
{ UINT_32 var = 6; Test_016( &var , &var ); |
|
} [/INST] The error is Identical actual parameters in call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct |
|
{ UINT_32 This_component_exceeds_thirty_one_characters_in_length; UINT_32 This_component_exceeds_thirty_one_characters_in_length_also; |
|
} struct17; |
|
static void SDA_017(void) |
|
{ UINT_32 This_identifier_exceeds_thirty_one_characters_in_length; UINT_32 This_identifier_exceeds_thirty_one_characters_in_length_also; struct17 mystruct; |
|
} [/INST] The error is Identifier not unique within *** characters. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 Re_Used; |
|
UINT_32 SDA_018( void ) |
|
{ UINT_32 Re_Used; Re_Used = 1; return Re_Used; |
|
} [/INST] The error is Identifier name reused. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_16 SDA_019(void) |
|
{ UINT_16 retval; retval = Test_19d(); return (retval); |
|
} |
|
UINT_32 Test_19d( void ) |
|
{ return (1u); |
|
} [/INST] The error is Procedure called before being defined. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static UINT_32 SDA_020(void) |
|
{ UINT_32 retval; retval = undeclared; return (retval); |
|
} [/INST] The error is No declaration for variable found before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 global = 0U; |
|
UINT_32 SDA_022(void) |
|
{ global++; return global; |
|
} [/INST] The error is Function has global variable side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_023( UINT_32 * par_1 ) |
|
{ *par_1 = 1; return (*par_1); |
|
} [/INST] The error is Function has parameter side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_024( UINT_32 * par_1 ) |
|
{ *par_1 = 1; |
|
} [/INST] The error is Procedure definition has no associated prototype. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 g_var_1 = 1; |
|
void SDA_025( UINT_32 * par_1 ) |
|
{ *par_1 = g_var_1; |
|
} [/INST] The error is Scope of variable could be reduced. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_57(void) |
|
{ UINT_32 x = 0U; x; (void)x; |
|
} [/INST] The error is Statement with no side effect. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_026; |
|
SINT_32 SDA_026; |
|
void SDA_026(void) |
|
{ |
|
} [/INST] The error is Variable should be defined once in only one file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 global_1 = 1; |
|
INT_32 global_2 = 2; |
|
static INT_32 SDA_027( void ) |
|
{ return global_2 - global_1; |
|
} |
|
INT_32 main( void ) |
|
{ return SDA_027() + SDA_027_2(); |
|
} [/INST] The error is Variable should be declared static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 global_2; |
|
INT_32 SDA_027_2 ( void ) |
|
{ return global_2; |
|
} [/INST] The error is Variable should be declared static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_028( void ) |
|
{ INT_32 i = 1; BOOL flag = TRUE; while (flag) { if (i==0) { flag = FALSE; } } |
|
} [/INST] The error is Potentially infinite loop found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s29 |
|
{ UINT_32 u1; UINT_32 u2; UINT_32 u3; |
|
}; |
|
static UINT_32 SDA_029( struct s29 s ) |
|
{ UINT_32 result; result = s.u1 + s.u2; return (result); |
|
} |
|
static UINT_32 Test_029( void ) |
|
{ UINT_32 a; struct s29 s; s.u1=1U; s.u2=2U; s.u3=3U; a = SDA_029( s ); return (a); |
|
} [/INST] The error is Partially used structure parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern UINT_32 global; |
|
UINT_32 sda_033_2(void) |
|
{ global++; return global; |
|
} [/INST] The error is No real declaration for external variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_034( UINT_32 a1 ) |
|
{ UINT_32 b = a1; b--; return b; |
|
} |
|
static UINT_32 test_034(void) |
|
{ UINT_32 a = 1U; a = SDA_034( a ); return a; |
|
} [/INST] The error is Procedure name re-used in different files. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 SDA_034( SINT_32 a1 ) |
|
{ SINT_32 b = a1; b--; return b; |
|
} [/INST] The error is Procedure name re-used in different files. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_035( UINT_32 par_1 ) |
|
{ UINT_32 result; UINT_32 var_1 = par_1; result = var_1++ + var_1; return (result); |
|
} [/INST] The error is Expression has side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_58(void) |
|
{ UINT_32 Timing_Loop = 100U; while ( Timing_Loop > 0U ); Timing_Loop--; ; |
|
} [/INST] The error is Null statement found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 No_Name( UINT_32 ); |
|
UINT_32 SDA_036( UINT_32 var_1 ); |
|
UINT_32 No_Name( UINT_32 name ) |
|
{ return name; |
|
} |
|
UINT_32 SDA_036( UINT_32 par_1 ) |
|
{ UINT_32 result; result = par_1; return result; |
|
} [/INST] The error is Prototype and definition name mismatch. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_037(void) |
|
{ static UINT_32 var_1; var_1++; return (var_1); |
|
} [/INST] The error is Function has persistent local side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_038( UCHAR *pArray, UINT_32 ArraySize) |
|
{ UCHAR element; UINT_32 stepup=0U, stepdn; stepdn = ArraySize; stepdn--; while( stepdn > stepup ) { element = pArray[ stepdn ]; pArray[ stepdn ] = pArray[ stepup ]; pArray[ stepup ] = element; stepup++; stepdn--; } |
|
} [/INST] The error is More than one control variable for loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_039( void ) |
|
{ UINT_32 it; for (it = 0; it < 42U; it++) { |
|
lb1: it++; |
|
lb2: it++; if (it == 7U) { goto lb1; } else { if (it == 9U) { goto lb2; } else { } } } |
|
} [/INST] The error is More than one entry to a loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_040( void ) |
|
{ UINT_32 it; for (it = 0U; it < 42U; it++) { if (it == 9U) { break; } else { } } |
|
} [/INST] The error is More than one exit from a loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_041( UINT_32 param ); |
|
void SDA_041( UINT_32 param ) |
|
{ UINT_32 result = foo( param ); |
|
} [/INST] The error is Procedure call has no prototype declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 * fn_D42( void ) |
|
{ INT_32 local_var = 22; return &local_var; |
|
} |
|
void SDA_042( void ) |
|
{ INT_32 * result = fn_D42(); |
|
} [/INST] The error is Local pointer returned in function result. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_043( void ) |
|
{ SINT_32 local_denominator = 0; SINT_32 numerator = 9; SINT_32 result = numerator / local_denominator; |
|
} [/INST] The error is Divide by zero found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SDA_045( UINT_32 * par_1 ) |
|
{ UINT_32 * lvar_1 = (UINT_32 *)malloc(sizeof(*lvar_1)); *lvar_1 = *par_1; |
|
} [/INST] The error is Pointer not checked for null before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SDA_047( UINT_32 * par_1 ) |
|
{ UINT_32 * lvar_1 = (UINT_32*)malloc(sizeof(lvar_1)); *lvar_1 = *par_1; |
|
} [/INST] The error is Unused inspect annotation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_59 (void) |
|
{ UINT_32 x = 2u; if ( x == 2u ) { ; } else if ( x == 3u) { ; } if ( x == 2u ) { ; } |
|
} [/INST] The error is Else alternative missing in if. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
void SDA_048( void ); |
|
void SDA_048( void ) |
|
{ FILE *inp, *outp; SINT_32 ch; inp = fopen(""infile.txt"", ""r""); do { ch = getc(inp); if (ch == (SINT_32)EOF) { } else { putc( ch, outp ); ch = getc(inp); } } while (ch != (SINT_32)EOF ); fclose(inp); fclose(outp); |
|
} [/INST] The error is Attempt to write to unopened file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
void SDA_049( void ) |
|
{ FILE *inp, *outp; SINT_32 ch; inp = fopen(""infile.txt"", ""r""); outp = fopen(""outfile.txt"", ""w""); do { ch = getc(inp); if (ch == (SINT_32)EOF) { } else { putc( ch, outp ); ch = getc(inp); } } while (ch != (SINT_32)EOF ); fclose(inp); |
|
} [/INST] The error is File pointer not closed on exit. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SDA_050( UINT_32 * par_1 ) |
|
{ UINT_32 * lvar_1 = (UINT_32 *)malloc(sizeof(lvar_1)); if (lvar_1 != (UINT_32 *)0) { *lvar_1 = *par_1; } lvar_1 = par_1; |
|
} [/INST] The error is Memory not freed after last reference. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
static void SDA_051( UINT_32 * par_1 ) |
|
{ UINT_32 * lvar_1 = (UINT_32 *)malloc(sizeof(lvar_1)); UINT_32 * lvar_2; if (lvar_1 != (UINT_32 *)0) { *lvar_1 = *par_1; free(lvar_1); *lvar_2 = *lvar_1; } |
|
} [/INST] The error is Attempt to read from freed memory. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_053( void) |
|
{ CHAR *ptr1, *ptr2; ptr1 = ptr2; |
|
} [/INST] The error is Attempt to use uninitialised pointer. </s>" |
|
"<s>[INST] find the error in this code: typedef struct struct_fn_t |
|
{ void (* s_fn)(struct struct_fn_t * s_fn_ptr); |
|
} struct_fn; |
|
void sda_054 ( void ) |
|
{ struct_fn s_fn_ptrs[10]; struct_fn * sda_054_p = &s_fn_ptrs[0]; sda_054_p->s_fn (sda_054_p++); |
|
} [/INST] The error is Unsafe use of function pointer variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_055( UINT_32 max_count ) |
|
{ UINT_32 loop_counter = 0U; for (loop_counter = 0U; loop_counter < max_count; loop_counter++) { if (loop_counter == 7U) { loop_counter++; } else { } } |
|
} [/INST] The error is Modification of loop counter in loop body. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
const SINT_32 g_var; |
|
void SDA_057( SINT_32 p_var ) |
|
{ SINT_32 result1 = g_var * p_var; |
|
} [/INST] The error is Global not initialised at declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_058( void ) |
|
{ CHAR str1[] = {'a', 'b', 'c'}; CHAR str2[] = {'d', 'a', 'f'}; CHAR str3[] = {'x', 'y', 'b'}; CHAR * some_string = ""Hello World""; CHAR * another_string = ""Hello World""; |
|
} [/INST] The error is Character or string literal re-used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UCHAR glob; |
|
static void sda_059( UCHAR par1, UCHAR par2, UCHAR arr3[5], const UCHAR arr4[5] ) |
|
{ par2 = glob; glob = par1; glob = arr3[0] + arr4[0]; |
|
} [/INST] The error is Parameter should be declared const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_060(SINT_32 p_1) |
|
{ switch (p_1) { } |
|
} [/INST] The error is Empty switch statement. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern SINT_32 some_int; |
|
extern SINT_32 some_int; |
|
SINT_32 some_int = 0; |
|
void sda_060( void ) |
|
{ ; } [/INST] The error is External object should be declared only once. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void helper_proc1( void ) { ; } |
|
void helper_proc2( void) { ; } |
|
void sda_061( void ) |
|
{ helper_proc1(); helper_proc2(); |
|
} [/INST] The error is Procedure should be declared static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
int main(void) |
|
{ sda_061(); return 0; |
|
} [/INST] The error is Procedure should be declared static. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void sda_063_1( void ); |
|
void sda_063_2( void ); |
|
void sda_063_1( void ) |
|
{ |
|
} |
|
int main(void) |
|
{ sda_063_1(); sda_063_2(); return 0; |
|
} [/INST] The error is No definition in system for prototyped procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static UINT_32 sda_064_1( void ) |
|
{ UINT_32 local_int; local_int = 0U; local_int++; return local_int; |
|
} [/INST] The error is Local not initialised at declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void sda_065_1( void ) |
|
{ UINT_32 local_int = 1U; local_int++; |
|
} [/INST] The error is Void function has no side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
extern UINT_16 sda_066_2( void ); |
|
static void sda_066( void ) |
|
{ SINT_32 loop; UINT_16 u8a = 0U; BOOL flag = FALSE; for( loop = 0; (loop < 10 ) && ( u8a != 42U ); ++loop ) { u8a = sda_066_2(); } for( loop = 0; (loop < 10 ) && flag; ++loop ) { u8a = sda_066_2(); flag = u8a != 42U; } |
|
} [/INST] The error is Non boolean control variable modified in loop. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 global = 0U; |
|
void sda_067_1( UINT_32 p1, UINT_32 p2 ) |
|
{ global = (global + p1) * p2; |
|
} |
|
void SDA_067( UINT_32 p3 ) |
|
{ sda_067_1( p3++, p3++ ); |
|
} [/INST] The error is Void function has global variable side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_068_1( UINT_32 p1, UINT_32 p2 ) |
|
{ static UINT_32 var_1; var_1 = (var_1 + p1) * p2; |
|
} |
|
void SDA_068_2( UINT_32 p3 ) |
|
{ SDA_068_1( p3++, p3++ ); |
|
} [/INST] The error is Void function has persistent local side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void sda_069 ( void ) |
|
{ UINT_32 var_1; var_1++; |
|
} [/INST] The error is UR anomaly, variable used before assignment. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_061(SINT_32 p_1) |
|
{ SINT_32 i = p_1; switch (p_1) { default: i++; } switch (p_1) { case 1: default: i++; } |
|
} [/INST] The error is Switch contains default only. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void sda_070 ( const UINT_32 p1 ) |
|
{ UINT_32 var_1 = 0U; UINT_32 var_2 = p1; var_1++; if ( p1 > 42U ) { printf(""%u\n"", var_2); } |
|
} [/INST] The error is DU anomaly, variable value is not used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 arr[] = {1U, 2U, 3U}; |
|
static UINT_32 sda_072_2( UINT_32 * p2 ) |
|
{ (*p2)++; return 1U; |
|
} |
|
static void sda_072_1( UINT_32 idx ) |
|
{ UINT_32 p1; p1 = arr[idx] + sda_072_2( &idx ); |
|
} [/INST] The error is Potential side effect problem in expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_073( void); |
|
SINT_32 ss = 0; |
|
SINT_32 st = 0; |
|
static void SDA_073( void) |
|
{ while( st > ss && (ss = 1) < 10 ){} |
|
} [/INST] The error is Predicate variable modified in condition. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void SDA_075( void) |
|
{ UINT_32 xx; FILE * fptr = fopen(""mikes.h"",""rw""); fscanf(fptr,""%d"",&xx ); if( xx == 0 ) { fptr = fopen(""mikes.h"",""rw""); } else { } |
|
} [/INST] The error is Attempt to open file pointer more than once. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_076 ( void) |
|
{ ; |
|
} |
|
SINT_32 main(void) |
|
{ |
|
} [/INST] The error is Procedure is not called or referenced in code analysed. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct tag |
|
{ UCHAR * uptr; |
|
}; |
|
static struct tag SDA_077 (void) |
|
{ UCHAR loc = 42; struct tag rtag; rtag.uptr = &loc; return rtag; |
|
} [/INST] The error is Local structure returned in function result. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void SDA_078( void); |
|
UCHAR glob=9; |
|
static void SDA_078( void ) |
|
{ UCHAR loc; loc = glob; |
|
} |
|
int main(void) |
|
{ SDA_078( ); |
|
} [/INST] The error is Global variable should be declared const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static SINT_32 func(SINT_32 pp) |
|
{ return pp; |
|
} |
|
static void SDA_080( void) |
|
{ SINT_32 x; x = func(1); |
|
} [/INST] The error is Potentially unused function-modified value. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
FILE * fptr; |
|
static void SDA_081( void) |
|
{ fptr = fopen(""mikes.h"",""r""); remove(""mikes.h""); fclose(fptr); |
|
} [/INST] The error is Attempt to remove an open file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void SDA_082( void) |
|
{ FILE * fptr; struct {SINT_32 ff;}astr; fpos_t * anoffset = (fpos_t *)&astr; fptr = fopen(""afile.h"",""w""); fsetpos(fptr,anoffset); |
|
} [/INST] The error is fsetpos values not generated by fgetpos. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_62(SINT_32 p_1) |
|
{ SINT_32 i = 0, j = 0; switch (p_1) { case 0: j = 0; case 1: j = i; break; default: i = j + 1; } |
|
} [/INST] The error is Switch case not terminated with break. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void SDA_083( SINT_32 par ); |
|
SINT_32 ch; |
|
FILE * fptr; |
|
static void SDA_083( SINT_32 par ) |
|
{ if( par == 341 ) { ungetc(ch,fptr); } if( par > 0 ) { ungetc(ch,fptr); } |
|
} [/INST] The error is Potentially repeated call to ungetc. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <string.h> |
|
static void SDA_084( void); |
|
static void SDA_084( void) |
|
{ int c,i; char data[256],append_data[256]; FILE *fp1; strcpy(append_data,""Some data to append""); fp1 = fopen(""pf1.txt"",""a+""); c = getc(fp1); fwrite(append_data,256,1,fp1); if (c != 'o') { fread(data,256,1,fp1); } fclose (fp1); |
|
} [/INST] The error is No fseek or flush before I/O. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <string.h> |
|
static void SDA_085( void) |
|
{ char ok_file_name[256],bad_file_name1[256],bad_file_name2[256]; FILE *fp1,*fp2,*fp3; strcpy(ok_file_name,""/home/ldra.txt""); fp1 = fopen(ok_file_name,""w""); scanf(""%s %s"",bad_file_name1,bad_file_name2); if (strcmp(bad_file_name2,""bad_file.txt"") != 0) { fp2 = fopen(bad_file_name1,""w""); fp3 = fopen(bad_file_name2,""w""); } fclose (fp1); fclose (fp2); fclose (fp3); |
|
} [/INST] The error is Filename not verified before fopen. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <string.h> |
|
static void SDA_086( void) |
|
{ char input_string1[256], input_string2[256]; scanf(""%s %s"",input_string1, input_string2); if (input_string2 != NULL) { fprintf(stderr, input_string1); } |
|
} [/INST] The error is User input not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <signal.h> |
|
#include <stdlib.h> |
|
#include <stdio.h> |
|
INT_32 glob_var; |
|
volatile sig_atomic_t e_flag = 0; |
|
void my_handler1(int signum) |
|
{ glob_var = 99; fprintf(stderr,""Signal %d encountered\n"",signum); |
|
} |
|
void my_handler2(int signum) |
|
{ e_flag = 99; fprintf(stderr,""Signal %d encountered\n"",signum); |
|
} |
|
void SDA_087(void) |
|
{ signal(SIGINT, my_handler1); signal(SIGTERM,my_handler2); |
|
} [/INST] The error is Illegal shared object in signal handler. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <signal.h> |
|
#include <string.h> |
|
#include <stdlib.h> |
|
#include <stdio.h> |
|
#include <setjmp.h> |
|
static jmp_buf env; |
|
static void my_handler1(int signum) |
|
{ fprintf(stderr,""Signal %d encountered\n"",signum); longjmp(env,1); |
|
} |
|
static void SDA_088(void) |
|
{ setjmp(env); signal(SIGINT,my_handler1); |
|
} [/INST] The error is Illegal use of longjmp in signal handler. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <signal.h> |
|
#include <string.h> |
|
#include <stdlib.h> |
|
#include <stdio.h> |
|
#include <setjmp.h> |
|
static jmp_buf env; |
|
void my_handler1(INT_32 signum) |
|
{ fprintf(stderr,""Signal %d encountered\n"",signum); |
|
} |
|
void my_handler2(INT_32 signum) |
|
{ fprintf(stderr,""Signal %d encountered\n"",signum); raise(SIGUSR1); |
|
} |
|
void SDA_089(void) |
|
{ signal(SIGUSR1, my_handler1); signal(SIGINT, my_handler2); |
|
} [/INST] The error is Signal called from within signal handler. </s>" |
|
"<s>[INST] find the error in this code: #include <pthread.h> |
|
#define NumOfThreads 2 |
|
int ind[] = {0, 1}; |
|
pthread_mutex_t mutexA; |
|
static pthread_t TheThread[NumOfThreads]; |
|
void *funcA( void * arg ); |
|
void *funcB( void * arg ); |
|
int count = 0; |
|
int main() |
|
{ int i, status; pthread_create( &TheThread[0], NULL, funcA , &ind[0]); pthread_create( &TheThread[1], NULL, funcB , &ind[1]); for(i = 0; i < NumOfThreads; i++) { pthread_join(TheThread[i], (void **)&status ); } |
|
} |
|
void *funcA( void * arg ) |
|
{ pthread_mutex_lock(&mutexA); count++; pthread_mutex_unlock(&mutexA); return 0; |
|
} |
|
void *funcB( void * arg ) |
|
{ pthread_mutex_unlock(&mutexA); count++; pthread_mutex_lock(&mutexA); return 0; |
|
} [/INST] The error is Unguarded global used in threaded function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 glob_res = 0U; |
|
static UINT_32 return_unsigned ( void ) |
|
{ return 4U; |
|
} |
|
static void SDA_091 ( UINT_32 x ) |
|
{ UINT_32 partused; partused = return_unsigned ( ); if ( x == 3 ) { glob_res = partused; } |
|
} [/INST] The error is Function return value potentially unused. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_093 ( void ) |
|
{ UINT_32 local = 44U; use_uint(local); |
|
} [/INST] The error is Local variable should be declared const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_63() |
|
{ |
|
} [/INST] The error is Empty parameter list to procedure/function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 SDA_094( void ) |
|
{ UINT_32 v_1; UINT_32 v_2; v_1 = 0; return v_1; |
|
} [/INST] The error is Named variable declared but not used in code. </s>" |
|
"<s>[INST] find the error in this code: extern void gf1(void); |
|
void (*gfptr)(void) = &gf1; |
|
void SDA_095(void) |
|
{ gfptr(); |
|
} [/INST] The error is Named global function pointer used in procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_096( void ) |
|
{ UINT_32 v_1 = 0U; v_1 = 3U; |
|
} [/INST] The error is Variable has repeated initialisation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <signal.h> |
|
#include <stdio.h> |
|
static void my_handler2(INT_32 signum) |
|
{ fprintf(stderr,""Signal %d encountered\n"", signum); |
|
} |
|
static void my_handler1(INT_32 signum) |
|
{ fprintf(stderr,""Signal %d encountered\n"", signum); signal(SIGHUP, my_handler2); |
|
} |
|
static void SDA_097(void) |
|
{ signal(SIGINT, my_handler1); |
|
} [/INST] The error is Signal called from within signal handler. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
void SDA_098(void) |
|
{ FILE *fp1; fp1 = fopen(""file1.dat"", ""r""); fprintf(fp1, ""Attempting to write to read-only file\n""); fclose(fp1); |
|
} [/INST] The error is Attempt to write to file opened read only. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_099(INT32 *p, INT32 **pp1, INT32 **pp2) |
|
{ INT_32 x; INT_32 *xp; x = *p; x = **pp1; xp = *pp2; |
|
} [/INST] The error is Named pointer object used in procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
void SDA_103(void) |
|
{ CHAR ch; FILE *fp1,*fp2; fp1 = fopen(""file1.txt"", ""r""); ch = getc(fp1); if (ch != (INT_32)EOF) { fp2 = fopen(""file1.txt"",""w""); } fclose (fp1); fclose (fp2); |
|
} [/INST] The error is File opened both read and write. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct not_opaque |
|
{ INT_32 a; CHAR c; |
|
}; |
|
typedef struct not_opaque *ptr_not_opaque; |
|
typedef struct opaque *ptr_opaque; |
|
void SDA_104(void) |
|
{ struct opaque opq; struct not_opaque nopq; ptr_opaque p_ok1 = &opq; ptr_opaque p_ok2; ptr_not_opaque p_nok1; p_ok2 = p_ok1; p_nok1 = &nopq; |
|
} [/INST] The error is Structure implementation not hidden. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
static void sda_105 ( const UINT_32 p1 ) |
|
{ UINT_32 var_1 = 0U; UINT_32 var_2 = p1; var_1++; if ( p1 > 42U ) { printf(""%u\n"", var_2); } |
|
} [/INST] The error is DU anomaly dead code, var value is unused on all paths. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_106( INT_32 * par_1 ) |
|
{ *par_1 = 1; |
|
} [/INST] The error is No prototype for non-static function. </s>" |
|
"<s>[INST] find the error in this code: #include <setjmp.h> |
|
#include ""c_standards.h"" |
|
static void static_7(jmp_buf mark, SINT_32 val) |
|
{ longjmp(mark,val); |
|
} [/INST] The error is Jump out of procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void) |
|
{ |
|
} |
|
void static_64(void) |
|
{ CHAR x; x = (CHAR) foo(); |
|
} [/INST] The error is Void procedure used in expression. </s>" |
|
"<s>[INST] find the error in this code: #include <stdlib.h> |
|
#include <string.h> |
|
void SDA_107( void ) |
|
{ char *error_str; char *buf = ""extra_text""; error_str = getenv (""MY_VAR""); strcat(error_str, buf); |
|
} [/INST] The error is Attempt to change system call capture string. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
extern void (*pfn)( ); |
|
#define GET_TAINTED_INT(val) \ do {const char *taint = getenv(""TAINT_I""); \ if (taint == NULL) {taint = ""42"";} \ val = strtol(taint, 0, 10); \ } while (0); |
|
void SDA_108(void) |
|
{ INT_32 tainted; GET_TAINTED_INT(tainted) (*pfn)(tainted); |
|
} [/INST] The error is Tainted argument to unprototyped func ptr. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
#define GET_TAINTED_INT(val) \ do {const char *taint = getenv(""TAINT_I""); \ if (taint == NULL) {taint = ""42"";} \ val = strtol(taint, 0, 10); \ } while (0); |
|
void SDA_109(void) |
|
{ INT_32 tainted; char buff[4]; GET_TAINTED_INT(tainted) (void) sprintf(buff, ""%d"", tainted); |
|
} [/INST] The error is Tainted argument to formatted i/o function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 fn(INT_32 a); |
|
INT_32 fn(INT_32 a); |
|
INT_32 fn(INT_32 a) |
|
{ return a; |
|
} |
|
void sda_110( void ) |
|
{ INT_32 rc; rc = fn(0); |
|
} [/INST] The error is More than one prototype for same function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <limits.h> |
|
#include <errno.h> |
|
void sda_111(const char *c_str) |
|
{ char *endpt1 = NULL; UINT_64 num1 = strtoul(c_str, &endpt1 ,0); if ( endpt1 == c_str || (num1 == ULONG_MAX && errno == ERANGE) ) { ; } else { ; } |
|
} |
|
int main( int argc, char *argv[] ) |
|
{ sda_111(""Hello""); |
|
} [/INST] The error is errno checked without having been set for errno setting fn. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <stdio.h> |
|
void sda_112(void) |
|
{ INT_32 *x = (INT_32*)malloc(10 * sizeof(INT_32)); if (x == NULL) { fprintf(stderr, ""malloc failure in %s\n"", __func__); free(x); } else { x[0] = 1; } free(x); |
|
} |
|
int main( int argc, char *argv[] ) |
|
{ sda_112(); |
|
} [/INST] The error is Free called twice on same variable. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
void SDA_113(int p1) |
|
{ FILE *fp1; fp1 = fopen(""data1.txt"",""r""); if (p1 == 0) { fclose(fp1); } fclose(fp1); |
|
} [/INST] The error is File closed more than once. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <string.h> |
|
void SDA_115(INT_32 *xfrom, UINT_32 sz) |
|
{ UINT_32 xsize; const UINT_32 csize = 5U; INT_32 *yto = (INT_32 *)malloc(10 * sizeof(INT_32)); if (yto != NULL) { xsize = sz; memcpy(yto, xfrom, xsize * sizeof(INT_32)); memcpy(yto, xfrom, csize); } |
|
} [/INST] The error is Copy length parameter not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_118(INT_32 * p1) |
|
{ *p1 = 77; |
|
} [/INST] The error is Object changed via dereferenced pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 glob = 0U; |
|
void sda_119( UINT_32 * const ptr1, UINT_32 *ptr2, UINT_32 *ptr3 ) |
|
{ *ptr1 = 0; *ptr2 = 0; ptr3 = &glob; |
|
} [/INST] The error is Pointer param should be declared const pointer. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void void_para_func(void P1) |
|
{ |
|
} |
|
void static_65( void ) |
|
{ void v_ptr; UINT_32 a; void_para_func(v_ptr); void_para_func((void)a); |
|
} [/INST] The error is Void variable passed as parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void sda_120( UINT_32 * pptr1, const UINT_32 * pptr2, UINT_32 * pptr3, UINT_32 arr1[ ], const UINT_32 arr2[ ] ) |
|
{ *pptr1 = *pptr2 + *pptr3; *pptr1 = arr1[0] + arr2[0]; |
|
} [/INST] The error is Pointer param should be declared pointer to const. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <limits.h> |
|
#include <errno.h> |
|
void sda_121(const char *c_str) |
|
{ char *endpt1 = NULL; unsigned long num1 = strtoul(c_str, &endpt1, 0); |
|
} |
|
int main( int argc, char *argv[] ) |
|
{ sda_121(""Hello""); |
|
} [/INST] The error is errno neither set nor checked for errno setting function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <limits.h> |
|
#include <errno.h> |
|
void sda_122(const char *c_str) |
|
{ char *endpt1 = NULL; errno = 0; unsigned long num1 = strtoul(c_str, &endpt1, 0); |
|
} |
|
int main( int argc, char *argv[] ) |
|
{ sda_122(""Hello""); |
|
} [/INST] The error is errno not checked after being set for errno setting fn. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
void SDA_123( void ) |
|
{ FILE *f = fopen(""file"", ""w""); fprintf(f, ""hello world\n""); fclose(f); |
|
} [/INST] The error is File pointer not checked for null before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
void sda_124( FILE *stream ) |
|
{ INT_32 in; INT_32 out; in = getc(stream); if ( in != EOF ) { (void)printf(""Input char %c\n"", (char)in); out = putc(in, stream); (void)printf(""Output char %c\n"", (char)out); } |
|
} [/INST] The error is Var set by std lib func return not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SDA_125(void) |
|
{ INT_32 *ptr = 0; free(ptr); |
|
} [/INST] The error is free called on variable with no allocated space. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
void SDA_126( void ) |
|
{ FILE *fp1; fclose(fp1); |
|
} [/INST] The error is File closed that was never opened. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_127( SINT_32 num, SINT_32 val ) |
|
{ SINT_32 result; SINT_32 denom = val; result = num / denom; if ( denom != 0 ) { result = num / denom; } |
|
} [/INST] The error is Local or member denominator not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 *glob1; |
|
UINT_32 *glob2; |
|
void SDA_128(void) |
|
{ UINT_32 loc = *glob1; UINT_32 loc2; if (glob2 != NULL) { loc2 = *glob2; } |
|
} [/INST] The error is Global pointer not checked within this procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
FILE *f1; |
|
FILE *f2; |
|
void SDA_129(void) |
|
{ fprintf(f1, ""hello world\n""); if (f2 != NULL) { fprintf(f2, ""hello world\n""); } |
|
} [/INST] The error is Global file pointer not checked within this procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_66 ( void ) |
|
{ return; |
|
} [/INST] The error is Function with empty return expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdio.h> |
|
#include <stdlib.h> |
|
SINT_32 glob1; |
|
SINT_32 glob2; |
|
void SDA_130(void) |
|
{ glob1 = atoi(""string 1""); printf(""glob1 = %d"", glob1); glob2 = atoi(""string 2""); if (glob2 > 0) { printf(""glob2 = %d"", glob2); } |
|
} [/INST] The error is Global set by std lib func return not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 glob1 = 1; |
|
SINT_32 glob2 = 1; |
|
void SDA_131(void) |
|
{ SINT_32 loc1; SINT_32 loc2; loc1 = 2 / glob1; if (glob2 > 0) { loc2 = 2 / glob2; } |
|
} [/INST] The error is Global denominator not checked within this procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <errno.h> |
|
#include <stdlib.h> |
|
void SDA_132 ( void ) |
|
{ FLOAT_64 f64; errno = 0; f64 = atof ( ""A.12"" ); if ( errno == 0 ) { ; } |
|
} [/INST] The error is errno checked after call to non-errno setting function. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
#include <locale.h> |
|
#include <time.h> |
|
void SDA_133( void ) |
|
{ char *ret_1; char *ret_2; ret_1 = setlocale ( LC_ALL, 0 ); ret_2 = setlocale ( LC_MONETARY, ""French"" ); ( void ) printf ( ""%s\n"", ret_1 ); |
|
} |
|
static void SDA_133_B ( time_t *t ) |
|
{ char * time1 = asctime(localtime(t)); char * time2 = ctime(t); printf(""%s"", time1); |
|
} |
|
static void SDA_133_C( time_t *t ) |
|
{ struct tm * tmptr1 = gmtime(t); struct tm * tmptr2 = localtime(t); printf(""%2d:%02d\n"", (tmptr1->tm_hour)%24,tmptr1->tm_min); |
|
} |
|
static void SDA_133_D( time_t *t ) |
|
{ const char *res2; struct lconv *lc = localeconv(); res2 = setlocale ( lc, ""French"" ); printf ( ""%s\n"", lc->currency_symbol ); |
|
} [/INST] The error is Pointer from system function used after subsequent call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <errno.h> |
|
#include <stdlib.h> |
|
extern void someFunction ( FLOAT_64 v ); |
|
void SDA_134 ( void ) |
|
{ char *endptr; FLOAT_64 value; errno = 0; value = strtod(str, &endptr); someFunction(value); if ( 0 != errno ) { } |
|
} [/INST] The error is errno not checked before subsequent function call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 glob = 1; |
|
void sda135(SINT_32 flag) |
|
{ SINT_32 *ptr1 = NULL; SINT_32 *ptr2 = NULL; SINT_32 val; if (flag == 1) { ptr1 = &glob; ptr2 = &glob; } val = *ptr1; if (ptr2 != NULL) { val = *ptr2; } |
|
} [/INST] The error is Global pointer assigned to NULL may be dereferenced. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 glob = 1; SINT_32 *glob_ptr1 = NULL; SINT_32 *glob_ptr2 = NULL; |
|
void sda135(SINT_32 flag) |
|
{ SINT_32 val; if (flag == 1) { glob_ptr1 = &glob; glob_ptr2 = &glob; } val = *glob_ptr1; if (glob_ptr2 != NULL) { val = *glob_ptr2; } |
|
} [/INST] The error is Global pointer assigned to NULL may be dereferenced. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_137(SINT_32 num, SINT_32 denom) |
|
{ SINT_32 loc1; result = num / denom; if (denom != 0) { result = num / denom; } assert( denom != 0 ); result = num / denom; |
|
} [/INST] The error is Parameter used as denominator not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include <stdio.h> |
|
#include <string.h> |
|
void SDA_138(void) |
|
{ char str[] = ""This is a test""; memset(str, '-', 5); printf(""%s"", str); |
|
} [/INST] The error is Third argument to memory function is an odd constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void SDA_139(SINT_32 *array, SINT_32 len, SINT_32 index) |
|
{ SINT_32 value; if (index < len) { value = array[index]; } else { value = -1; } |
|
} [/INST] The error is Incorrect array index validation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
void static_067(UINT_32 p_1) |
|
{ UINT_32 local_x = 0; |
|
#define BLOCKDEF ""test"" local_x = strlen(BLOCKDEF); |
|
} [/INST] The error is #define used in a block. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
#include <stdlib.h> |
|
#include <stdio.h> |
|
#define MAX_SIZE 64 |
|
void SDA_141( char * input ) |
|
{ if (strlen(input) > MAX_SIZE) { printf(""Input string too long""); } else { UINT_32 index = 5U; UINT_32 i; char *buffer = (char *)malloc(MAX_SIZE); for (i = 0U; i < strlen(input); i++) { buffer[index++] = input[i]; } } |
|
} [/INST] The error is Heap-based array index not checked before use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static BOOL SDA_151( void ) |
|
{ BOOL flag; flag = FALSE; flag = TRUE; return flag; |
|
} |
|
static BOOL SDA_151_1( void ) |
|
{ BOOL flag = FALSE; flag = TRUE; return flag; |
|
} [/INST] The error is DD data flow anomaly found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 xref_1; |
|
static void xref_001 ( void ) |
|
{ ; |
|
} [/INST] The error is Declaration types do not match across a system. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 xref_1; [/INST] The error is Declaration types do not match across a system. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 xref_1; |
|
SINT_32 xref_1; |
|
void xref_002(void) |
|
{ |
|
} [/INST] The error is Ambiguous declaration of variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 g_var = 1; |
|
static void XREF_003( SINT_32 p_var ) |
|
{ SINT_32 result1 = p_var; SINT_32 result2; result2 = p_var; SINT_32 result3; result3 = result2; |
|
} [/INST] The error is Variable has only one use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void bar(void); |
|
void bar(void) |
|
{ struct stag_name { UINT_32 us1; UINT_32 us2; } sobj1; struct stag_name sobj2 = {1, 2}; |
|
} |
|
void foo(void) |
|
{ struct stag_name { SINT_32 ss1; CHAR ch1; } sobj3; |
|
} [/INST] The error is Identifier reuse: struct/union tag repeated. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
union utag_name uobj2 = {0}; |
|
static void xref_001(void) |
|
{ struct utag_name { UINT_32 ss1; UINT_32 ss2; } sobj1; |
|
} [/INST] The error is Identifier reuse: struct vs union. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
void foo(void) |
|
{ enum utag_name { first, second } sobj1; |
|
} [/INST] The error is Identifier reuse: struct/union tag vs enum tag. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
#define BLOCKDEF ""test"" |
|
void static_68(void) |
|
{ UINT_32 local_x = 0U; local_x = strlen(BLOCKDEF); |
|
} |
|
#undef BLOCKDEF [/INST] The error is #undef used </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void stag_name(void); |
|
union stag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
void stag_name(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: tag vs procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 utag_name); |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
void foo(UINT_32 utag_name) |
|
{ |
|
} [/INST] The error is Identifier reuse: tag vs typedef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
void foo(void) |
|
{ UINT_32 utag_name; |
|
} [/INST] The error is Identifier reuse: tag vs variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
void xref_10(void) |
|
{ |
|
utag_name: uobj1.us1 = 0; |
|
} [/INST] The error is Identifier reuse: tag vs label (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef double utag_name; |
|
union utag_name |
|
{ SINT_32 us1; CHAR us2; |
|
} uobj1; |
|
static void xref_011 ( void ) |
|
{ |
|
} [/INST] The error is Identifier reuse: tag vs typedef. </s>" |
|
"<s>[INST] find the error in this code: #define s_tag2 sn1 |
|
#include ""c_standards.h"" |
|
typedef struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_type; [/INST] The error is Identifier reuse: tag vs macro. </s>" |
|
"<s>[INST] find the error in this code: #define s_tag sn2 |
|
#define u_tag sn3 |
|
#include ""c_standards.h"" |
|
typedef struct s_tag2 |
|
{ UINT_32 comp3; UINT_32 comp4; |
|
} s_type2; |
|
typedef union u_tag |
|
{ SINT_32 us1; CHAR us2; |
|
} u_type; |
|
void xref_012 ( void ) |
|
{ ; |
|
} [/INST] The error is Identifier reuse: tag vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct stag_name |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} stag_type; |
|
void foo(void); |
|
void foo(void) |
|
{ struct sloctag_name { UINT_32 stag_name; } sobj1; |
|
} [/INST] The error is Identifier reuse: tag vs component. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct s_name1_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_name1_type; |
|
typedef enum e_name1_tag |
|
{ first, s_name1_tag |
|
} e_name1_type; |
|
void foo(void); |
|
void foo(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: tag vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
static UINT_32 static_var2; |
|
void foo(void) |
|
{ struct static_var2 { UINT_32 xx1; UINT_32 yy1; } ss1; |
|
} [/INST] The error is Identifier reuse: persistent var vs tag. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#pragma MYERROR |
|
static void static_69(void) |
|
{ ; |
|
} [/INST] The error is #pragma used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef char t_name; |
|
void foo(void); |
|
void foo(void) |
|
{ UINT_32 t_name; |
|
} [/INST] The error is Identifier reuse: typedef vs variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_17_1(void) |
|
{ typedef char lab_name; |
|
} |
|
UINT_32 xref_17(void) |
|
{ UINT_32 retval = 0; |
|
lab_name: return retval; |
|
} [/INST] The error is Identifier reuse: typedef vs label (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_018_1(void) |
|
{ typedef double t_name; t_name local_var; |
|
} |
|
void xref_018(void) |
|
{ typedef char t_name; t_name local_var; |
|
} [/INST] The error is Identifier reuse: typedef vs typedef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef char t_name; |
|
void foo(UINT_32 t_name); |
|
void foo(UINT_32 t_name) |
|
{ |
|
} [/INST] The error is Identifier reuse: typedef vs procedure parameter. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef double static_var1; |
|
void foo(void); |
|
void foo(void) |
|
{ static UINT_32 static_var1; |
|
} [/INST] The error is Identifier reuse: persistent var vs typedef. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef int s_tag; |
|
#define s_tag sn1 |
|
static void xref_021 ( void ) |
|
{ ; |
|
} [/INST] The error is Identifier reuse: typedef vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef struct my_struct_tag |
|
{ UINT_32 comp1; UINT_32 t_name; |
|
} my_struct_type; |
|
typedef char t_name; |
|
void foo(void); |
|
void foo(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: typedef vs component. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void bar(void); |
|
void foo(void) |
|
{ typedef struct s_tag { UINT_32 comp1; UINT_32 comp2; } s_type; |
|
} |
|
void bar(void) |
|
{ typedef enum e_tag { first, s_type } e_type; |
|
} [/INST] The error is Identifier reuse: typedef vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc1(void); |
|
void proc2(void); |
|
void proc1(void) |
|
{ |
|
} |
|
void proc2(void) |
|
{ typedef char proc1; |
|
} [/INST] The error is Identifier reuse: typedef vs procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void proc1(UINT_32 param, UINT_32 another_param); |
|
static void proc1(UINT_32 param, UINT_32 another_param) |
|
{ |
|
} |
|
static void xref_25(UINT_32 proc1) |
|
{ |
|
} [/INST] The error is Identifier reuse: procedure vs procedure param. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_70(UINT_32 * p1_ptr, UINT_32 * p2_ptr ) |
|
{ if ( p1_ptr > p2_ptr ) { } |
|
} [/INST] The error is Logical comparison of pointers. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_26_1(void) |
|
{ static UINT_32 s_var; |
|
} |
|
UINT_32 xref_26(void) |
|
{ |
|
s_var: return 0; |
|
} [/INST] The error is Identifier reuse: persistent var vs label (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_27(void); |
|
UINT_32 p_var; |
|
void xref_27(void) |
|
{ static UINT_32 p_var; |
|
} [/INST] The error is Identifier reuse: persist var vs persist var. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_28(void); |
|
UINT_32 var1; |
|
void xref_28(void) |
|
{ UINT_32 var1; |
|
} [/INST] The error is Identifier reuse: persistent var vs var. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void xref_29(void); |
|
void foo(void) |
|
{ |
|
} |
|
void xref_29(void) |
|
{ static UINT_32 foo; |
|
} [/INST] The error is Identifier reuse: persistent var vs procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 pp); |
|
void xref_30(void); |
|
void foo(UINT_32 pp) |
|
{ |
|
} |
|
void xref_30(void) |
|
{ static UINT_32 pp; |
|
} [/INST] The error is Identifier reuse: persistent var vs proc param. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_031 (UINT_32 pp) |
|
{ |
|
} [/INST] The error is Identifier reuse: procedure vs procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void xref_031 (void) |
|
{ |
|
} [/INST] The error is Identifier reuse: procedure vs procedure. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void xref_32(void); |
|
void foo(void) |
|
{ |
|
} |
|
void xref_32(void) |
|
{ UINT_32 foo; |
|
} [/INST] The error is Identifier reuse: procedure vs var </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void) |
|
{ |
|
} |
|
UINT_32 xref_33(void) |
|
{ |
|
foo: return 0; |
|
} [/INST] The error is Identifier reuse: procedure vs label (MR) </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void foo() |
|
{ |
|
} [/INST] The error is Identifier reuse: proc vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 *ptr; |
|
UINT_32* static_71( void ) |
|
{ static UINT_32 w = 10u; UINT_32 local = 3U; UINT_32 *local_ptr = &local; ptr = &local; ptr = local_ptr; return &w; |
|
} [/INST] The error is Pointer assignment to wider scope. </s>" |
|
"<s>[INST] find the error in this code: #define foo sn1 |
|
#include ""c_standards.h"" |
|
void xref_34(void); |
|
void xref_34() |
|
{ |
|
} [/INST] The error is Identifier reuse: proc vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
void comp1(void); |
|
void comp1(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: proc vs component. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void xref_36(void); |
|
void foo(void) |
|
{ |
|
} |
|
void xref_36(void) |
|
{ enum e_tag { first, second, foo } e_obj; |
|
} [/INST] The error is Identifier reuse: proc vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void foo(void) |
|
{ static UINT_32 p_var = 0; |
|
} [/INST] The error is Identifier reuse: persistent var vs macro. </s>" |
|
"<s>[INST] find the error in this code: #define p_var sn1 |
|
#include ""c_standards.h"" |
|
void xref_37(void); |
|
void xref_37(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: persistent var vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
void xref_38(void); |
|
void xref_38(void) |
|
{ static UINT_32 comp1; |
|
} [/INST] The error is Identifier reuse: persistent var vs component. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum e_tag |
|
{ first, second |
|
} e_obj; |
|
void foo(void); |
|
void xref_39(void) |
|
{ static UINT_32 first; |
|
} [/INST] The error is Identifier reuse: persistent var vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
void foo(void); |
|
void foo(void) |
|
{ UINT_32 comp1; |
|
} [/INST] The error is Identifier reuse: component vs var. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_41_1(void) |
|
{ UINT_32 u_var; |
|
} |
|
UINT_32 xref_41(void) |
|
{ |
|
u_var: return 0; |
|
} [/INST] The error is Identifier reuse: label vs variable (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
void foo(UINT_32 comp2); |
|
void foo(UINT_32 comp2) |
|
{ |
|
} [/INST] The error is Identifier reuse: component vs procedure param. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_72 {SINT_32 x:1; }; |
|
void static_72( void) |
|
{ |
|
} [/INST] The error is Signed bit field less than 2 bits wide. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void xref_43_1(UINT_32 u_var) |
|
{ |
|
} |
|
UINT_32 xref_43(void) |
|
{ |
|
u_var: return 0; |
|
} [/INST] The error is Identifier reuse: label vs procedure param (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
enum e_tag |
|
{ comp1, two |
|
} e_obj; |
|
void foo(void); |
|
void foo(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: component vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 lab1; UINT_32 comp2; |
|
} s_obj; |
|
UINT_32 xref_45(void) |
|
{ |
|
lab1: return 0; |
|
} [/INST] The error is Identifier reuse: component vs label (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum e_tag |
|
{ lab1, second, |
|
} e_obj; |
|
UINT_32 xref_46(void) |
|
{ |
|
lab1: return 0; |
|
} [/INST] The error is Identifier reuse: label vs enum constant (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj; |
|
void foo(void); |
|
void foo(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: component vs macro. </s>" |
|
"<s>[INST] find the error in this code: #define comp2 sn1 |
|
#include ""c_standards.h"" |
|
void bar(void); |
|
void bar(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: component vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 xref_48_1(void) |
|
{ |
|
lab1: return 0; |
|
} [/INST] The error is Identifier reuse: label vs macro (MR). </s>" |
|
"<s>[INST] find the error in this code: #define lab1 sn1 |
|
#include ""c_standards.h"" |
|
void xref_48(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: label vs macro (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 pp); |
|
void bar(void); |
|
void foo(UINT_32 pp) |
|
{ |
|
} |
|
void bar(void) |
|
{ UINT_32 pp; |
|
} [/INST] The error is Identifier reuse: var vs proc param. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void foo(void) |
|
{ UINT_32 loc_var = 0; |
|
} [/INST] The error is Identifier reuse: var vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_73 |
|
{ UCHAR x:1; |
|
}; |
|
void static_73(void) |
|
{ |
|
} [/INST] The error is Bit field not signed or unsigned int. </s>" |
|
"<s>[INST] find the error in this code: #define loc_var sn1 |
|
#include ""c_standards.h"" |
|
void bar(void); |
|
void bar(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: var vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum e_tag |
|
{ first, second |
|
} e_obj; |
|
void foo(void); |
|
void foo(void) |
|
{ UINT_32 first; |
|
} [/INST] The error is Identifier reuse: var vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void proc1(UINT_32 param); |
|
static void proc2(UINT_32 param); |
|
static void proc1(UINT_32 param) |
|
{ |
|
} |
|
static void proc2(UINT_32 param) |
|
{ |
|
} [/INST] The error is Identifier reuse: proc param vs proc param. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 param); |
|
void foo(UINT_32 param) |
|
{ |
|
} [/INST] The error is Identifier reuse: proc param vs macro. </s>" |
|
"<s>[INST] find the error in this code: #define param sn1 |
|
#include ""c_standards.h"" |
|
void bar(void); |
|
void bar(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: proc param vs macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(UINT_32 param); |
|
void bar(void); |
|
void foo(UINT_32 param) |
|
{ |
|
} |
|
void bar(void) |
|
{ enum e_tag { first, second, param } e_obj; |
|
} [/INST] The error is Identifier reuse: proc param vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 xref_55_1(void) |
|
{ |
|
lab1: return 0;+A663 |
|
} |
|
UINT_32 xref_55(void) |
|
{ |
|
lab2: return 0; |
|
} [/INST] The error is Identifier reuse: label vs label (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
enum e_tag |
|
{ first, runnerup |
|
} e_obj; |
|
void foo(void); |
|
void foo(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: macro vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #define runnerup sn1 |
|
#include ""c_standards.h"" |
|
void bar(void); |
|
void bar(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: macro vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_tag1 |
|
{ UINT_32 comp1; UINT_32 comp2; |
|
} s_obj1; |
|
struct s_tag2 |
|
{ UINT_32 comp1; UINT_32 comp3; |
|
} s_obj2; |
|
void xef_58(void); |
|
void xef_58(void) |
|
{ |
|
} [/INST] The error is Identifier reuse: component vs component </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_8 (void) |
|
{ UINT_32 name_x = 1u; if (name_x == 0u) { } else ; if (name_x == 0u) { } else { |
|
#if FALSE name_x = name_x + 1u; |
|
#endif } if (name_x == 0u) { } else { ; } |
|
} [/INST] The error is Empty else clause. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
union s_74{UCHAR fu; UINT_32 xu;}; |
|
void static_74(void) |
|
{ |
|
} [/INST] The error is Union declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void bar(void); |
|
void foo(void) |
|
{ enum e_tag1 { first, runnerup } e_obj1; |
|
} |
|
void bar(void) |
|
{ enum e_tag2 { first, second } e_obj2; |
|
} [/INST] The error is Identifier reuse: enum constant vs enum constant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void foo(void); |
|
void bar(void); |
|
void foo(void) |
|
{ UINT_32 local_var = 0; |
|
} |
|
void bar(void) |
|
{ UINT_32 local_var = 0; |
|
} [/INST] The error is Identifier reuse: variable vs variable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 global_variable_with_long_name1x; |
|
UINT_32 global_variable_with_long_name1y; |
|
void XREF_061(void) |
|
{ |
|
} [/INST] The error is Identifier match in *** chars. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef unsigned int ANOTHER_UINT_32; |
|
ANOTHER_UINT_32 xref_62(void); |
|
UINT_32 xref_62(void) |
|
{ UINT_32 ret_val = 0; return ret_val; |
|
} [/INST] The error is Function prototype/defn return type mismatch (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
typedef unsigned int ANOTHER_UINT_32; |
|
UINT_32 xref_63(ANOTHER_UINT_32 p1); |
|
UINT_32 xref_63(UINT_32 p1) |
|
{ UINT_32 ret_val = p1; return ret_val; |
|
} [/INST] The error is Function prototype/defn param type mismatch (MR) </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 indexArray ( const INT_32 array [] ) |
|
{ return array[4]; |
|
} |
|
INT_32 XREF_064 ( void ) |
|
{ INT_32 array[3] = {1, 2, 3}; return indexArray( array ); |
|
} [/INST] The error is Array bound exceeded at call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void XREF_065 ( void ) |
|
{ INT_32 j = -1; INT_32 i; for ( i = 0; i != 10 && j != i; ++i ) { if ( ( i % 2 ) == 0 ) { continue; } ++j; } |
|
} [/INST] The error is continue in ill-formed loop (MR). </s>" |
|
"<s>[INST] find the error in this code: void copy (char src_array[]) |
|
{ char dest_arr[3]; (void) strcpy (dest_arr, src_array); |
|
} |
|
void XREF_066 ( void ) |
|
{ char arrc[10]; copy(arrc); |
|
} |
|
int main ( void ) |
|
{ XREF_066 ( ); |
|
} [/INST] The error is Insufficient array space at call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void xref_67( void ); |
|
static void xref_67 ( void ) |
|
{ INT_32 id1_a_bc; INT_32 id1_ab_c; INT_32 id2_ii; INT_32 id2_11; INT_32 id3_i0; INT_32 id3_1O; INT_32 id4_in; INT_32 id4_1h; INT_32 id5_Z5; INT_32 id5_2S; INT_32 id6_ZS; INT_32 id6_25; ; |
|
} [/INST] The error is Identifier is typographically ambiguous. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 index_too_large ( UINT_32 index ) |
|
{ INT_32 array[10] = {0}; return array[index]; |
|
} |
|
INT_32 XREF_068( void ) |
|
{ return index_too_large( 20U ); |
|
} [/INST] The error is Parameter indexing array too big at call. </s>" |
|
"<s>[INST] find the error in this code: void static_75(void) |
|
{ |
|
#include ""c_standards.h"" |
|
} [/INST] The error is Executable code before an included file. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 array[3] = {1, 2, 3}; |
|
INT_32 XREF_069 ( void ) |
|
{ return array[3]; |
|
} [/INST] The error is Global array bound exceeded at use. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void copy (char *dest_array) |
|
{ char src_array[8] = ""abcdefg""; (void) strcpy (dest_array, src_array); |
|
} |
|
void XREF_070 ( void ) |
|
{ char arr_3[3]; copy(arr_3); |
|
} |
|
int main ( void ) |
|
{ XREF_070 ( ); |
|
} [/INST] The error is Array has insufficient space. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
void copy (char *dest_array, char *src_array) |
|
{ (void) strcpy (dest_array, src_array); |
|
} |
|
void XREF_071 ( void ) |
|
{ char arr_3[3]; char src_array[8] = ""abcdefg""; copy(arr_3, src_array); |
|
} |
|
int main ( void ) |
|
{ XREF_071 ( ); |
|
} [/INST] The error is Insufficient space for copy. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 XREF_072 ( INT_32 index ) |
|
{ INT_32 array[10] = {0}; return array[index]; |
|
} |
|
#define OFFSET 12 |
|
INT_32 main ( void ) |
|
{ return XREF_072(10-OFFSET); |
|
} [/INST] The error is Parameter indexing array too small at call. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1) |
|
{ UCHAR res; res = p1 >> 3; |
|
} |
|
void XREF_O73( void ) |
|
{ proc(7U); |
|
} [/INST] The error is Bits discarded in >> by parameter in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1) |
|
{ UCHAR res; res = 15U << p1; |
|
} |
|
void XREF_O74( void ) |
|
{ proc(7U); |
|
} [/INST] The error is Bits discarded in << by parameter in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1) |
|
{ UCHAR res; res = 3U >> p1; |
|
} |
|
void XREF_O75( void ) |
|
{ proc(7U); |
|
} [/INST] The error is Bits discarded in >> by parameter in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1) |
|
{ UCHAR res; res = p1 << 6; |
|
} |
|
void XREF_O76( void ) |
|
{ proc(15U); |
|
} [/INST] The error is Bits discarded in << on parameter in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1, UCHAR p2) |
|
{ UCHAR res; res = p1 >> p2; |
|
} |
|
void XREF_O77( void ) |
|
{ proc(3U, 7U); |
|
} [/INST] The error is Bits discarded in >> between parameters in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void proc(UCHAR p1, UCHAR p2) |
|
{ UCHAR res; res = p1 << p2; |
|
} |
|
void XREF_O78( void ) |
|
{ proc(3U, 7U); |
|
} [/INST] The error is Bits discarded in << between parameters in function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void dummy(CHAR *p_1, CHAR *p_2) |
|
{ |
|
} |
|
#define SetVariable( Variable, Value ) ( dummy(NewString##Variable, #Value )) |
|
void static_76(void) |
|
{ CHAR NewString1[128]; INT_32 value = 10; SetVariable(1, value ); |
|
} [/INST] The error is More than one of # or ## in a macro. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <string.h> |
|
static void check_dest(SINT_32 len1) |
|
{ SINT_32 src1[40]; SINT_32 tgt1[12]; memcpy(tgt1, src1, len1); |
|
} |
|
static void check_src(SINT_32 len2) |
|
{ SINT_32 src2[12]; SINT_32 tgt2[40]; memcpy(tgt2, src2, len2); |
|
} |
|
static void XREF_079( void ) |
|
{ check_dest(12 * 4); check_dest(40 * 4); check_src(12 * 4); check_src(40 * 4); |
|
} [/INST] The error is Size mismatch in memcpy/memset. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static const SINT_32 FIVE = 5; |
|
static const SINT_32 SIX = 6; |
|
static void div(SINT_32 divisor) |
|
{ SINT_32 i = 7; i = i / divisor; |
|
} |
|
static void call_div(SINT_32 num) |
|
{ div(num); |
|
} |
|
static void XREF_080( void ) |
|
{ call_div( SIX - 5 ); call_div( FIVE - 5 ); |
|
} [/INST] The error is Divide by zero found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 InfoFlow001( void ) |
|
{ UINT_32 result = 0; UINT_32 if_1 = 0; return (result); |
|
} [/INST] The error is Local variables contribute nothing to results. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static UINT_32 glob = 0U; |
|
BOOL Test1( UINT_32 Position, UINT_32 *Won ) |
|
{ if ( Position == 1U ) { *Won = *Won + 1; } return ( Position == 1U ); |
|
} |
|
INT_32 Test2 ( void ) |
|
{ glob = 3; return glob; |
|
} |
|
INT_32 Test3 ( void ) |
|
{ return glob; |
|
} |
|
void QUALREP_001( UINT_32 RacePosition, BOOL sofar ) |
|
{ BOOL bWonAll = TRUE; UINT_32 WonCount = 0U; bWonAll = sofar && ( Test1( RacePosition, &WonCount ) ) ; WonCount = Test2() + Test3(); |
|
} [/INST] The error is Call has execution order dependant side effects. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL isHexDigit( CHAR TestChar ) |
|
{ BOOL bResult; bResult = FALSE; if ((TestChar == '0') || (TestChar == '1') || (TestChar == '2') || (TestChar == '3') || (TestChar == '4') || (TestChar == '5') || (TestChar == '6') || (TestChar == '7') || (TestChar == '8') || (TestChar == '9') || (TestChar == 'A') || (TestChar == 'a') || (TestChar == 'B') || (TestChar == 'b') || (TestChar == 'C') || (TestChar == 'c') || (TestChar == 'D') || (TestChar == 'd') || (TestChar == 'E') || (TestChar == 'e') || (TestChar == 'F') || (TestChar == 'f')) { bResult = TRUE; } return bResult; |
|
} [/INST] The error is LCSAJ density exceeds *** </s>" |
|
"<s>[INST] find the error in this code: #include ""C:\Testbed\Examples\Standards\C\Violations\Quality_report\c_standards.h"" |
|
#include <sys/limits.h> |
|
void QUALREP_004(void) |
|
{ |
|
} [/INST] The error is Included file has path. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void unreachable_fn ( void ) |
|
{ ; |
|
} |
|
UINT_32 j_001 (BOOL param) |
|
{ UINT_32 local_var; void (*fnptr) (void); fnptr = & unreachable_fn; if (param == TRUE ) { local_var = param; } else { local_var = 0U; } if ( 0 ) { fnptr(); } return local_var; return 0; |
|
} [/INST] The error is Unreachable Code found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 j_002 (BOOL param) |
|
{ UINT_32 local_var; if (param == TRUE ) { local_var = param; } else { local_var = 0U; } return local_var; return 0; |
|
} [/INST] The error is Unused inspect annotation. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static INT_32 proc( void ) |
|
{ return 1; |
|
} |
|
void j_003 ( void ) |
|
{ return; (void)proc(); |
|
} [/INST] The error is All internal linkage calls unreachable. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define increment_NOK(a) ( a ) + 1 |
|
#define increment_OK(b) ( ( b ) + 1 ) |
|
void static_77(void) |
|
{ INT_32 result = 1; result = increment_NOK(result) * 3; result = 1; result = increment_OK(result) * 3; |
|
} [/INST] The error is Macro replacement list needs parentheses. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
INT_32 myglobal; |
|
INT_32 g_var1; |
|
void hungarian_1 ( void ) |
|
{ ; |
|
} [/INST] The error is Global Variable does not conform to style g_<name>. </s>" |
|
"<s>[INST] find the error in this code: enum EColour {e_Red, blue, e_white }; |
|
void hungarian_3 ( void ) |
|
{ enum EColour flag; |
|
} [/INST] The error is Enum Element does not conform to style e_<name>. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void hungarian_6 ( INT_32 *p_x, INT_32 *my_ptr ) |
|
{ ; |
|
} [/INST] The error is Pointer does not conform to style p_<name>. </s>" |
|
"<s>[INST] find the error in this code: enum Colour {e_red, e_blue, e_white }; |
|
enum Etraffic{ e_green, e_yellow, e_red }; |
|
void hungarian_7 ( void ) |
|
{ enum Colour flag; enum Etraffic light; |
|
} [/INST] The error is Enum Name does not conform to style E<name>. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void Hungarian_nok ( void ) |
|
{ ; |
|
} |
|
void Hungarian_008_ok ( void ) |
|
{ ; |
|
} [/INST] The error is Global Func Name does not conform to style <file>_<name>. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
_Atomic INT_32 atomic_var = 65; |
|
_Noreturn void SV_15 ( INT_32 i ) |
|
{ if ( i > 0 ) { exit( i ); } |
|
} [/INST] The error is Use of banned keyword. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SF_1 ( void ) |
|
{ SINT_32 the_seed = 17; SINT_32 x = rand(); SINT_32 y = rand_r(&the_seed); |
|
} [/INST] The error is Function restricted by POSIX Safety Profile substitution. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <unistd.h> |
|
void SF_2(void) |
|
{ SINT_32 res; char *name; SINT_32 the_mode; res = access(name, the_mode); |
|
} [/INST] The error is Function restricted by POSIX Safety Profile substitution. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
void SF_3(void) |
|
{ SINT_32 the_status = 1; _exit(the_status); |
|
} [/INST] The error is Use of FACE Security Profile excluded function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <math.h> |
|
void SF_4(void) |
|
{ float inpf; float outf; double inpd; double outd; outf = acosf(inpf); outd = acos(inpd); |
|
} [/INST] The error is Use of FACE Safety Base Profile excluded function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define multiply(a1, a2) ((a1)*a2) |
|
static void static_78(void) |
|
{ SINT_32 test; SINT_32 p1 = 2; SINT_32 p2 = 5; test = ( multiply(100,p1) ); test = ( multiply(100,p1-p2) ); |
|
} [/INST] The error is Use of FACE Safety Extended Profile excluded function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <libgen.h> |
|
void SF_5(void) |
|
{ char *name; char *the_path; name = basename(the_path); |
|
} [/INST] The error is Use of FACE General Purpose Profile excluded function. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <sys/socket.h> |
|
void SF_6(void) |
|
{ SINT_32 soc; soc = socket(AF_INET, SOCK_DGRAM, 0); |
|
} [/INST] The error is Use of POSIX function restricted to IOSS/TSS segments. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include ""apex_types.h"" |
|
struct myMessage |
|
{ SINT_32 id; SINT_64 value; |
|
}; |
|
void SF_7(void) |
|
{ APEX_INTEGER pid; struct myMessage msg; RETURN_CODE_TYPE ret; CREATE_QUEUING_PORT ( ""myQuePort"", sizeof (struct myMessage), 3, SOURCE, FIFO, &(pid), &(ret)); |
|
} [/INST] The error is Use of ARINC 653 function restricted to IOSS/TSS segments. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#include <mqueue.h> |
|
#define MAX_SIZE 1024 |
|
void SF_8(void) |
|
{ mqd_t dest_q; char msg[MAX_SIZE] = ""Some Message""; SINT_32 ret; dest_q = mq_open(""/test_queue"", O_WRONLY); ret = mq_send(dest_q, msg, MAX_SIZE, 0); |
|
} [/INST] The error is Safety Profile use of message queue API needs inspection. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#include <stdlib.h> |
|
#pragma pack(4) |
|
void SF_9(void) |
|
{ ; |
|
} [/INST] The error is Use of data structure pragmas. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define t void |
|
t static_79(t) |
|
{ |
|
} [/INST] The error is Macro contains unacceptable items. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_80(void) |
|
{ UINT_32 array[10] = {0}; UINT_32 * p1_ptr, **p2_ptr; UINT_32 *** p3_ptr; UINT_32 w; p1_ptr = array; p2_ptr = &p1_ptr; p3_ptr = &p2_ptr; w = ***p3_ptr; |
|
} [/INST] The error is Pointer indirection exceeds 2 levels. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_81(void) |
|
??< |
|
} [/INST] The error is Use of trigraph. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_82(void) |
|
{ wchar_t WideChar = L'1'; |
|
} [/INST] The error is Use of wide string literal. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_83(void) |
|
{ UINT_32 i; i = (UINT_32) 076; |
|
} [/INST] The error is Octal number found. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL static_9(BOOL test) |
|
{ BOOL result,flag; result = ( flag = test ); return result; |
|
} [/INST] The error is Assignment operation in expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_84(void) |
|
{ register SINT_32 ri = 0; |
|
} [/INST] The error is Register variable declared. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_85(void) |
|
{ enum E_type { num1, num2 = 2, num3}; |
|
} [/INST] The error is Incomplete initialisation of enumerator. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
#define FILE UINT_32 |
|
void static_86(void) |
|
{ |
|
} [/INST] The error is Attempt to define reserved word. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_87(void) |
|
{ UINT_32 w; UINT_32 array[5]; UINT_32 * p1_ptr; p1_ptr = array; w = *(p1_ptr + 8); |
|
} [/INST] The error is Use of pointer arithmetic. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_88(void) |
|
{ UINT_32 x; x=0; _asm { mov eax,x } |
|
} [/INST] The error is Procedure is not pure assembler. </s>" |
|
"<s>[INST] find the error in this code: void use_char ( char notok ) |
|
{ ; } |
|
void static_89 ( void ) |
|
{ char num = 42; |
|
} [/INST] The error is char type not signed or unsigned. </s>" |
|
"<s>[INST] find the error in this code: #include <wchar.h> |
|
unsigned int static_90 (void) |
|
{ char ch; unsigned char uc; unsigned int ui_32; unsigned short ui_16; int i_32; float f_32; double f_64; signed char sc; wchar_t wc; return ui_32; |
|
} [/INST] The error is Basic type declaration used. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_91 |
|
{ UINT_32 s_91; UINT_32 u_1; |
|
}; |
|
UINT_32 static_91 (void) |
|
{ UINT_32 var_1; |
|
static_91: var_1 = 1; return (var_1); |
|
} [/INST] The error is Name redeclared in another C name space (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 duplicate = 0; |
|
void static_92 (void) |
|
{ enum Name_type { e1, duplicate } EnumVar; EnumVar = e1; |
|
} [/INST] The error is Duplicate use of a name in an enumeration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_97(void) |
|
{ SINT_32 sx; SINT_32 sy = 10; sx = (SINT_32)sy; sx = (SINT_32)(5 + 4); |
|
} [/INST] The error is Use of redundant cast. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
SINT_32 static_11( void ) |
|
{ SINT_32 j = 10; SINT_32 k = 0; for (k = 0; k < 10; k = k + 1) j--; return j; |
|
} [/INST] The error is No brackets to loop body (added by Testbed). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void fn( UINT_16 p_1, UINT_16 p_2 ) |
|
{ ; |
|
} |
|
void static_98(UINT_32 p_1, UINT_16 p_2) |
|
{ fn(p_1, p_2); |
|
} [/INST] The error is Actual and formal parameters inconsistent (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL test_99(void) |
|
{ BOOL retval= TRUE; return retval;} |
|
void static_99(void) |
|
{ if ( test_99 ) { } |
|
} [/INST] The error is Function use is not a call. </s>" |
|
"<s>[INST] find the error in this code: #include <\ctype.h> |
|
static void static_100(void) |
|
{ |
|
} [/INST] The error is #include filename is non conformant. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_101( UINT_32 par_1) |
|
{ switch (par_1) { case 0: return (-1); break; case 1: return (2U); break; case 2: return (2L); break; case 2: return (2UL); break; case 4: return (2.0f); break; default: break; } |
|
} [/INST] The error is Function return type inconsistent. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
UINT_32 static_102(UINT_32 p_1, UINT_16 p_2); |
|
SINT_32 static_102(UINT_32 p_1, UINT_16 p_2) |
|
{ SINT_32 result = 0; return result; |
|
} [/INST] The error is Function and prototype return inconsistent (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
BOOL static_103(FLOAT_32 up_1); |
|
BOOL static_103(UINT_32 up_1) |
|
{ BOOL ret = FALSE; return ret; |
|
} [/INST] The error is Function and prototype param inconsistent (MR). </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct s_type_a { SINT_32 xs; FLOAT_32 fs;}; |
|
void static_104(void) |
|
{ struct s_type_a sta = {3.14F, 0.0f}; |
|
} [/INST] The error is Struct field initialisation incorrect. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
struct pixel{ UINT_32 colour; struct {UINT_32 x, y;} coords; }; |
|
void static_105(void) |
|
{ UINT_32 xs = 0; UINT_32 ys = 0; struct pixel spot = {1u, xs, ys }; |
|
} [/INST] The error is Initialisation brace { } fault. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
void static_106(void) |
|
{ volatile UINT_32 v = 1U; UINT_32 x = 0; x = v; |
|
} [/INST] The error is Volatile declaration. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_107( BOOL flag ) |
|
{ UINT_16 u16 = 2U; UINT_32 u32 = 3U; FLOAT_32 f32 = 4.0F; x = (flag ? f32 : u32); x = (flag ? u32 : u16); |
|
} [/INST] The error is Type mismatch in ternary expression. </s>" |
|
"<s>[INST] find the error in this code: #include ""c_standards.h"" |
|
static void static_107( BOOL flag ) |
|
{ UINT_16 u16 = 2U; UINT_32 u32 = 3U; FLOAT_32 f32 = 4.0F; x = (flag ? f32 : u32); x = (flag ? u32 : u16); |
|
} [/INST] The error is Type mismatch in ternary expression. </s>" |
|
|