text
stringlengths 110
791
|
---|
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[INST] find the error in this code: void complex_5 ( void )
{
label1: goto label1;
} [/INST] The error is Procedure contains infinite loop. |
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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. |