slang icon indicating copy to clipboard operation
slang copied to clipboard

slanc fails silently if host prelude doesn't compile

Open expipiplus1 opened this issue 2 years ago • 3 comments

For example, put the following in prelude/slang-cpp-host-prelude.h

#if defined(__SLANG_COMPILER__)
#error
#endif 

Make and run the following command

./bin/linux-x64/debug/slangc tests/bugs/interface-lvalue.slang -o a.exe

Observe that this finishes with exit code 0 and nothing on stderr, however a.exe is not created.

expipiplus1 avatar Apr 23 '23 06:04 expipiplus1

After a cursory look, it seems that GCCDownstreamCompilerUtil::parseOutput, hence CommandLineDownstreamCompiler::compile fails.

The error is converted to a nullptr return by TargetProgram::_createWholeProgramResult and then ignored by EndToEndCompileRequest::generateOutput

Because the gcc output parsing failed there are no diagnostics, so the check if (getSink()->getErrorCount() != 0) doesn't detect any errors.

expipiplus1 avatar Apr 23 '23 06:04 expipiplus1

We should have a --verbose option to say what we're calling downstream compilers with, and what their output is.

expipiplus1 avatar May 02 '23 23:05 expipiplus1

Silent failures bad, language hardening, Q3.

natduca avatar Dec 01 '23 00:12 natduca