-
-
Save mrdomino/5f7de7b4aa9f74d13747 to your computer and use it in GitHub Desktop.
probable gcc bug triggered on -O2 -fvect-cost-model=unlimited -ftree-loop-vectorize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <hammer/glue.h> | |
#include <hammer/hammer.h> | |
#include <inttypes.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
typedef enum { | |
TT_thingy = TT_USER, | |
TT_thingy2 | |
} ThingyTokenType; | |
typedef struct { | |
int n; | |
int data[4]; | |
} thingy; | |
typedef struct { | |
int a; | |
thingy t; | |
} thingy2; | |
HParsedToken* | |
act_thingy(const HParseResult* p, void* user_data) | |
{ | |
size_t i; | |
thingy* out = H_ALLOC(thingy); | |
out->n = h_seq_len(p->ast); | |
for (i = 0; i < out->n; i++) { | |
out->data[i] = H_FIELD_UINT(i); | |
} | |
return H_MAKE(thingy, out); | |
} | |
HParsedToken* | |
act_thingy2(const HParseResult* p, void* user_data) | |
{ | |
thingy2* out = H_ALLOC(thingy2); | |
out->a = H_FIELD_UINT(0); | |
out->t = *H_FIELD(thingy, 1); | |
return H_MAKE(thingy2, out); | |
} | |
int main() { | |
HParseResult *p; | |
/* 33x 6a7a8a4a9a */ | |
char input[] = "\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A\x6A\x7A\x8A\x5A\x4A\x9A"; | |
H_ARULE(thingy, h_repeat_n(h_bits(10, false), 4)); | |
H_ARULE(thingy2, h_sequence(h_uint16(), thingy, NULL)); | |
H_RULE(parser, h_many1(thingy2)); | |
p = h_parse(parser, input, sizeof input); | |
if (p) { | |
fprintf(stderr, "size:%" PRIu64 "\n", p->bit_length); | |
} | |
else fputs("parse error\n", stderr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment