text
stringlengths 110
791
|
---|
<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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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>[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. |