Skip to content

[CIL] Miscellaneous Parse Errors #147

@difcsi

Description

@difcsi

Following yesterday's discussions about CIL, I decided to spend a coffee break today to try to break it. I discovered some parse errors, some of which are fixed by goblint-cil. I'm not quite sure which C standard Stephen-Cil targets but #129 mentions work on C23, so most of these could be relevant.

Errors on C11, commit 1adb5c6

Type Switches

Works on Goblint CIL

int type_switch(){
	int a = _Generic((1), int: (1), default: (1));
	return 0;
}

Digraphs

Parse error on Goblint CIL as well

int digraphs()<% 
    int c = 0;
%>

Anonymous union member

Parse error on Goblint CIL as well

struct S {union { int x; float f};}; 

Complex number macros

Parse error on Goblint CIL as well

#include <complex.h>
double complex z = 1.0 + 2.0*I;

Offsetof

Parse error on Goblint CIL as well

struct S { int x; float f; } s;
int offs =  offsetof(struct S, x);

Below this, GNU extensions

Statement expression

Parse error on Goblint CIL as well

int x = ({ int t = 2; t*t; });

Computed Goto labels

Parse error on Goblint CIL as well

void *labels[] = { &&L1, &&L2 };
goto *labels[i];

alignas, alternative token for align_as

Works on Goblint CIL

alignas(32) char buf[64];

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions