some statements in OSL are optimized away
Closed, InvalidPublic

Description

--- Operating System, Graphics card ---

w7-64, full system info in .blend

--- Blender version with error, and version that worked ---

2.67b release, also present in r53600 and experimental blender-2.67-r57607-win64-vc11

--- Short description of error ---

In a very short shader some statements following an assignment to an ouput socket based on input sockets alone are not executed. If a second statement is added that alters the output socket in a way that is not based on the input values alone, the statements *are* executed. Referering to, but not altering the ouput socket is not enough to prevent this issue (as is illustrated by the if statement in the code that refers to the output socket and is always true).

Note: I am not sure, but this might be related to issue 35791

--- Steps for others to reproduce the error (preferably based on attached .blend file) ---

- open attached .blend, enable console
- click recompile button on script node, observe OSL compilation succeeded
- enable rendered view in 3d view window, observe small yellow rectangle and printed lines on console
- comment out line 8 in the text editor
- click recompile button on script node, observe OSL compilation succeeded, a small red rectangle and NO printed lines on console

Details

Type
Bug

Posted to the OSL issue tracker now:
https://github.com/imageworks/OpenShadingLanguage/issues/267

This appears to be the intended behavior, see the OSL issue for the explanation.