Compare commits

...

2 Commits

Author SHA1 Message Date
0ce9f9aafa Add --show-error-list=yes to valgrind options. Invalid opcode again!
To run "make memcheck", uncomment Makefile line 36 (-m no-tbm).
Without this, I get :
vex amd64->IR: unhandled instruction bytes: 0x8F 0xEA 0xF8 0x10 0xFF 0x23 0x1D 0x0 0x0 0x89
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==888233== valgrind: Unrecognised instruction at address 0x109336.
2022-09-20 19:58:30 +02:00
ea530e7d8d 2019 day 4, minor is_valid() simplification 2022-09-20 19:57:27 +02:00
2 changed files with 8 additions and 11 deletions

View File

@@ -41,7 +41,8 @@ CFLAGS += -DDEBUG_DEBUG # activate general debug (debug.c)
CFLAGS += -DDEBUG_POOL # memory pools management
VALGRIND := valgrind
VALGRINDFLAGS := -q -s --leak-check=full --show-leak-kinds=all --track-origins=yes
VALGRINDFLAGS := --leak-check=full --show-leak-kinds=all --track-origins=yes \
--sigill-diagnostics=yes --quiet --show-error-list=yes
TIME := \time -f "\ttime: %E real, %U user, %S sys\n\tcontext-switch:\t%c+%w, page-faults: %F+%R\n"

View File

@@ -34,16 +34,12 @@ static int is_valid(int number, int part)
dups[digit] += 2;
}
}
if (!valid)
return 0;
if (part == 2) {
valid = 0;
for (int i = 0; i < 10; ++i) {
if (!valid || part == 1)
return valid;
for (int i = 0; i < 10; ++i)
if (dups[i] == 2)
return 1;
}
}
return valid;
return 0;
}
static int doit(int *nums, int part)