summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rogers <[email protected]>2018-10-05 13:54:53 -0400
committerGitHub <[email protected]>2018-10-05 13:54:53 -0400
commit68134d5eb326552fc1ef4b02b2eb21103266283b (patch)
treed63ae36cdb2fcf735677f66cf8ef91d94444b925
parentcbdf8bd70cf5707dada1741d98125b60c0db7843 (diff)
parentb1fd283c064222579ee5174a980abf72e8e6ef26 (diff)
Merge pull request #15 from gjulianm/dev
Naive fix of OpenCL parse errors
-rw-r--r--src/cuda-sim/ptx.l4
-rw-r--r--src/cuda-sim/ptx.y2
-rw-r--r--src/cuda-sim/ptx_parser.cc2
3 files changed, 5 insertions, 3 deletions
diff --git a/src/cuda-sim/ptx.l b/src/cuda-sim/ptx.l
index 5471d6f..af015c9 100644
--- a/src/cuda-sim/ptx.l
+++ b/src/cuda-sim/ptx.l
@@ -36,7 +36,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ptx.tab.h"
#include <string.h>
-char linebuf[1024];
+char linebuf[4096];
unsigned col = 0;
#define TC col+=strlen(ptx_text);
#define CHECK_UNSIGNED \
@@ -382,7 +382,7 @@ breakaddr TC; ptx_lval.int_value = BREAKADDR_OP; return OPCODE;
"//"[^\n]* TC; // eat single
-\n.* col=0; strncpy(linebuf, yytext + 1, 1024); yyless( 1 );
+\n.* col=0; strncpy(linebuf, yytext + 1, sizeof(linebuf)); yyless( 1 );
" " TC;
"\t" TC;
diff --git a/src/cuda-sim/ptx.y b/src/cuda-sim/ptx.y
index 4edae5d..342c37d 100644
--- a/src/cuda-sim/ptx.y
+++ b/src/cuda-sim/ptx.y
@@ -269,6 +269,7 @@ ptr_spec: /*empty*/
ptr_space_spec: GLOBAL_DIRECTIVE { add_ptr_spec(global_space); }
| LOCAL_DIRECTIVE { add_ptr_spec(local_space); }
| SHARED_DIRECTIVE { add_ptr_spec(shared_space); }
+ | CONST_DIRECTIVE { add_ptr_spec(global_space); }
ptr_align_spec: ALIGN_DIRECTIVE INT_OPERAND
@@ -330,6 +331,7 @@ var_spec_list: var_spec
var_spec: space_spec
| type_spec
| align_spec
+ | VISIBLE_DIRECTIVE
| EXTERN_DIRECTIVE { add_extern_spec(); }
| WEAK_DIRECTIVE
;
diff --git a/src/cuda-sim/ptx_parser.cc b/src/cuda-sim/ptx_parser.cc
index a180da9..49c8472 100644
--- a/src/cuda-sim/ptx_parser.cc
+++ b/src/cuda-sim/ptx_parser.cc
@@ -265,7 +265,7 @@ void parse_assert_impl( int test_value, const char *file, unsigned line, const c
parse_error_impl(file,line, msg);
}
-extern char linebuf[1024];
+extern char linebuf[4096];
void set_return()