[hackers] [scc] Use eqtype() before of decay() || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Tue, 19 Jan 2016 15:40:04 +0100 (CET)

commit ea7eeb566e8f2493e3495d974ba587ffabbe027d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Tue Jan 19 14:55:15 2016 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Tue Jan 19 14:55:15 2016 +0100

    Use eqtype() before of decay()
    
    When we have matrices of multiple dimensions the type returned
    by initlist() is an array, which must match the type of the
    row of the outer array. If we call decay() then the type of the
    array is lost.

diff --git a/cc1/init.c b/cc1/init.c
index 6418da2..5d103a0 100644
--- a/cc1/init.c
+++ b/cc1/init.c
_AT_@ -98,9 +98,11 @@ initialize(Type *tp)
 
         np = (accept('{')) ? initlist(tp) : assign();
         sym = np->sym;
- if (sym && (sym->flags & ISSTRING) != 0 && tp->op == ARY) {
+ if (sym && sym->flags&ISSTRING && tp->op == ARY) {
                 btp = tp->type;
- if (btp != chartype && btp != uchartype && btp != schartype) {
+ if (btp != chartype &&
+ btp != uchartype &&
+ btp != schartype) {
                         errorp("array of inappropriate type initialized from string constant");
                         goto return_zero;
                 }
_AT_@ -117,6 +119,8 @@ initialize(Type *tp)
 
                 return np;
         }
+ if (eqtype(tp, np->type))
+ return np;
         if ((aux = convert(decay(np), tp, 0)) != NULL)
                 return aux;
 
Received on Tue Jan 19 2016 - 15:40:04 CET

This archive was generated by hypermail 2.3.0 : Tue Jan 19 2016 - 15:48:32 CET