Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Fix segfault when a function does not have a name
authorGabriel Corona <gabriel.corona@loria.fr>
Thu, 9 Oct 2014 13:59:29 +0000 (15:59 +0200)
committerGabriel Corona <gabriel.corona@loria.fr>
Thu, 9 Oct 2014 13:59:29 +0000 (15:59 +0200)
This happens when compiling with LLVM (clang/dragonegg).

src/mc/mc_ignore.c

index 480a74b..8ee35e5 100644 (file)
@@ -224,7 +224,8 @@ static void mc_ignore_local_variable_in_scope(const char *var_name,
   // Processing of direct variables:
 
   // If the current subprogram matche the given name:
-  if (subprogram_name == NULL || strcmp(subprogram_name, subprogram->name) == 0) {
+  if (!subprogram_name ||
+      subprogram->name && strcmp(subprogram_name, subprogram->name) == 0) {
 
     // Try to find the variable and remove it:
     int start = 0;