https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69278

            Bug ID: 69278
           Summary: Confusion option handling for -sanitize-recovery=alll
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
                    jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
  Target Milestone: ---

As I've just read opts.c, passing -fsanitize-recovery=all enables recovery mode
for all options except SANITIZE_USER_ADDRESS, SANITIZE_THREAD, SANITIZE_LEAK.

/* Handle both -fsanitize and -fno-sanitize cases.  */
if (value && spec[i].flag == ~0U)
 {
  if (code == OPT_fsanitize_)
    error_at (loc, "-fsanitize=all option is not valid");
  else
    *flag |= ~(SANITIZE_USER_ADDRESS | SANITIZE_THREAD | SANITIZE_LEAK);

AFAIK that's because of one cannot enable -fsanitize=leak with one of
-fsanitize=address or -fsanitize=thread.

However, following command line contains just one and I would expect to enable
recovery mode for -fsanitize=address:

$ g++ -fsanitize=address missing-store.C -g -fsanitize-recover=all
$ ASAN_OPTIONS="halt_on_error=0" ./a.out
...
==20905==ABORTING

OTOH:
$ g++ -fsanitize=address missing-store.C -g -fsanitize-recover=address
$ ASAN_OPTIONS="halt_on_error=0" ./a.out && echo $?
0

Maybe we should enable recovery for all and mask it at the end of opts parsing
with flag_sanitize?
If it's a good approach, I can come up with a patch.

Thanks,
Martin

Reply via email to