Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
3112b568
Commit
3112b568
authored
Oct 19, 2017
by
John Kessenich
Committed by
GitHub
Oct 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1113 from xorgy/preprocessor-int-min-over-negative-one
Preprocessor: Evaluate INT_MIN / -1 to 0.
parents
0b55e0f2
dc756a61
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
cppIntMinOverNegativeOne.frag.out
Test/baseResults/cppIntMinOverNegativeOne.frag.out
+14
-0
cppIntMinOverNegativeOne.frag
Test/cppIntMinOverNegativeOne.frag
+4
-0
Pp.cpp
glslang/MachineIndependent/preprocessor/Pp.cpp
+2
-1
AST.FromFile.cpp
gtests/AST.FromFile.cpp
+1
-0
No files found.
Test/baseResults/cppIntMinOverNegativeOne.frag.out
0 → 100644
View file @
3112b568
cppIntMinOverNegativeOne.frag
Shader version: 100
0:? Sequence
0:? Linker Objects
Linked fragment stage:
ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point
Shader version: 100
0:? Sequence
0:? Linker Objects
Test/cppIntMinOverNegativeOne.frag
0 → 100644
View file @
3112b568
#if (-2147483648 / -1) != 0
#error INT_MIN / -1 should yield 0, something went wrong.
#endif
\ No newline at end of file
glslang/MachineIndependent/preprocessor/Pp.cpp
View file @
3112b568
...
...
@@ -84,6 +84,7 @@ NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <climits>
#include "PpContext.h"
#include "PpTokens.h"
...
...
@@ -350,7 +351,7 @@ namespace {
int
op_add
(
int
a
,
int
b
)
{
return
a
+
b
;
}
int
op_sub
(
int
a
,
int
b
)
{
return
a
-
b
;
}
int
op_mul
(
int
a
,
int
b
)
{
return
a
*
b
;
}
int
op_div
(
int
a
,
int
b
)
{
return
a
/
b
;
}
int
op_div
(
int
a
,
int
b
)
{
return
a
==
INT_MIN
&&
b
==
-
1
?
0
:
a
/
b
;
}
int
op_mod
(
int
a
,
int
b
)
{
return
a
%
b
;
}
int
op_pos
(
int
a
)
{
return
a
;
}
int
op_neg
(
int
a
)
{
return
-
a
;
}
...
...
gtests/AST.FromFile.cpp
View file @
3112b568
...
...
@@ -78,6 +78,7 @@ INSTANTIATE_TEST_CASE_P(
"matrixError.vert"
,
"cppSimple.vert"
,
"cppIndent.vert"
,
"cppIntMinOverNegativeOne.frag"
,
"cppNest.vert"
,
"cppBad.vert"
,
"cppBad2.vert"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment