<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ccc-analyzer does not accept CCC_CC/CCC_CXX with quotes"
   href="https://llvm.org/bugs/show_bug.cgi?id=26220">26220</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>ccc-analyzer does not accept CCC_CC/CCC_CXX with quotes
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>simon.kagstrom@netinsight.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We're using ccache to speed up compilation, so in our system, CC is set to
"ccache gcc-4.9" (basically). We want and need to run scan-build with the same
underlying compiler, so we run it with the CCC_CC="$(CC)" environment variable.

However, ccc-analyzer doesn't accept this, but falls back to the default
compiler instead. An easy way to reproduce this is to do

 $ touch /tmp/a.c      # Empty C source
 $ CCC_CC=ls ccc-analyzer /tmp/a.c
 /tmp/a.c
 $ CCC_CC="true ; ls" ccc-analyzer /tmp/a.c
 /usr/bin/ld: [...]: relocation 0 has invalid symbol index 11

so in the second case, ccc-analyzer ignores CCC_CC and falls back to gcc. My
Perl-knowledge is extremely limited, but I believe this is caused by
ccc-analyzer verifying that the compiler exists in the path:

 # Search in the PATH if the compiler exists
 sub SearchInPath {
    my $file = shift;
    foreach my $dir (split (':', $ENV{PATH})) {
        if (-x "$dir/$file") {
            return 1;
        }
    }
    return 0;
 }
 [...]

  $Compiler = $ENV{'CCC_CC'};
  if (!defined $Compiler || (! -x $Compiler && ! SearchInPath($Compiler))) {
$Compiler = $DefaultCCompiler; }


I tested this with clang-3.7, but the latest ccc-analyzer seems to have the
same construct. Obviously, the same is true for the handling of CCC_CXX.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>