Bug 96727 - Wrong column number in shader compilation info log
Summary: Wrong column number in shader compilation info log
Status: NEW
Alias: None
Product: Mesa
Classification: Unclassified
Component: glsl-compiler (show other bugs)
Version: 10.3
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-29 14:55 UTC by Ruslan Kabatsayev
Modified: 2016-07-09 04:08 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruslan Kabatsayev 2016-06-29 14:55:09 UTC
Consider the following fragment shader:

void main()
{
    int N=100;
    float floA=0.9, floB=234.9;

    float x0=(floA-0.5*N)/floB;
   float x1=(floA-0.5*N)/floB;
  float x2=(floA-0.5*N)/floB;
float x3=(floA-0.5*N)/floB;
    gl_FragColor=vec4(0);
}


Notice the different indentation levels of lines with x0,x1,x2,x3.

Since there's no #version directive here, it's GLSL 1.10, so the implicit conversions are not available at all. So glCompileShader results in the following info log:

0:6(17): error: could not implicitly convert operands to arithmetic operator
0:6(12): error: operands to arithmetic operators must be numeric
0:6(11): error: operands to arithmetic operators must be numeric
0:7(17): error: could not implicitly convert operands to arithmetic operator
0:7(12): error: operands to arithmetic operators must be numeric
0:7(11): error: operands to arithmetic operators must be numeric
0:8(17): error: could not implicitly convert operands to arithmetic operator
0:8(12): error: operands to arithmetic operators must be numeric
0:8(11): error: operands to arithmetic operators must be numeric
0:9(16): error: could not implicitly convert operands to arithmetic operator
0:9(11): error: operands to arithmetic operators must be numeric
0:9(10): error: operands to arithmetic operators must be numeric

So far so good. But you can see that column 17 is always given for indented lines in the "could not convert" message (similar problem is with "must be numeric" lines) regardless of indentation level, and only when there're no spaces before the line is the column reported differently.
Actually correct columns are in the last two instances of "could not convert" message: it looks like the string is first simplified by merging repeated whitespace into one space, and only then the column is counted. Of course, this is misleading and actually somewhat useless to the reader, which doesn't understand what happens with the message.

So the fix should be either to show correct column numbers, or not to show column at all.
Comment 1 Ruslan Kabatsayev 2016-06-29 15:55:45 UTC
Also reproducible with Mesa 11.0.2.
Comment 2 Ilia Mirkin 2016-07-09 04:08:20 UTC
I believe that glcpp is normalizing the spaces. Not sufficiently familiar with it to know how to undo that.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.