text
stringlengths
110
791
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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 // comment.
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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 // comment in pre-processor directive or macro defn.
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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.