[前][次][番号順一覧][スレッド一覧]

ruby-changes:48605

From: nobu <ko1@a...>
Date: Thu, 9 Nov 2017 08:09:31 +0900 (JST)
Subject: [ruby-changes:48605] nobu:r60720 (trunk): parse.y: fix r60644

nobu	2017-11-09 08:09:25 +0900 (Thu, 09 Nov 2017)

  New Revision: 60720

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60720

  Log:
    parse.y: fix r60644
    
    * parse.y (rb_strterm_heredoc_t): should not define sourceline as
      union, to fix wrong read on big-endian platforms.
      as rb_imemo_new stores all members as VALUEs, should read it as
      VALUE too.

  Modified files:
    trunk/parse.y
Index: parse.y
===================================================================
--- parse.y	(revision 60719)
+++ parse.y	(revision 60720)
@@ -757,10 +757,7 @@ typedef struct rb_strterm_literal_struct https://github.com/ruby/ruby/blob/trunk/parse.y#L757
 } rb_strterm_literal_t;
 
 typedef struct rb_strterm_heredoc_struct {
-    union {
-	VALUE dummy;
-	int sourceline;
-    } u1;
+    SIGNED_VALUE sourceline;
     VALUE term;		/* `"END"` of `<<"END"` */
     VALUE lastline;	/* the string of line that contains `<<"END"` */
     union {
@@ -6793,7 +6790,7 @@ parser_heredoc_restore(struct parser_par https://github.com/ruby/ruby/blob/trunk/parse.y#L6790
     lex_pend = lex_pbeg + RSTRING_LEN(line);
     lex_p = lex_pbeg + here->u3.lastidx;
     heredoc_end = ruby_sourceline;
-    ruby_sourceline = here->u1.sourceline;
+    ruby_sourceline = (int)here->sourceline;
     token_flush(parser);
 }
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]