# New Ticket Created by  Nick Glencross 
# Please include the string:  [perl #34984]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34984 >


[I submitted this patch from a web mailer last night, but it seems to 
have disappeared into the ether. If the other copy ever appears, just 
ignore it!]

This patch fixes a problem which can occur in this example:

.sub test
        .const float a = 12
        print a
        print_newline
.end

The symbol 'knows' that it is a float, and the value thinks that it is 
an int. I think that bogus bytecode might then be emitted, using the 
print_nc opcode, but with an int argument?

For the moment we can generate an error, but in the longer term perhaps 
we can massage the value to the same type as the variable. Let me know, 
and I'll cook this up,

Cheers,

Nick
Index: imcc/symreg.c
===================================================================
--- imcc/symreg.c       (revision 7825)
+++ imcc/symreg.c       (working copy)
@@ -314,6 +314,10 @@
 {
     SymReg *r;
 
+    if (t != 'P' && t != val->set)
+        IMCC_fataly(interp, E_TypeError,
+                    "const types do not match");
+
     if (global) {
         if (t == 'P') {
             IMCC_fataly(interp, E_SyntaxError,

Reply via email to