- if (IS_LITERAL (RETYPE (tree))) {
- #if 0
- if (IS_PTR (LTYPE (tree)) && !IS_GENPTR (LTYPE (tree)) ) {
- /* rewrite (type *)litaddr
- as &temp
- and define type at litaddr temp
- (but only if type's storage class is not generic)
- */
- ast *newTree = newNode ('&', NULL, NULL);
- symbol *sym;
-
- TTYPE (newTree) = LTYPE (tree);
- TETYPE (newTree) = getSpec(LTYPE (tree));
-
- /* define a global symbol at the casted address*/
- sym = newSymbol(genSymName (0), 0);
- sym->type = LTYPE (tree)->next;
- if (!sym->type)
- sym->type = newLink (V_VOID);
- sym->etype = getSpec(sym->type);
- SPEC_SCLS (sym->etype) = sclsFromPtr (LTYPE (tree));
- sym->lineDef = tree->lineno;
- sym->cdef = 1;
- sym->isref = 1;
- SPEC_STAT (sym->etype) = 1;
- SPEC_ADDR(sym->etype) = floatFromVal (valFromType (RTYPE (tree)));
- SPEC_ABSA(sym->etype) = 1;
- addSym (SymbolTab, sym, sym->name, 0, 0, 0);
- allocGlobal (sym);
-
- newTree->left = newAst_VALUE(symbolVal(sym));
- newTree->left->lineno = tree->lineno;
- LTYPE (newTree) = sym->type;
- LETYPE (newTree) = sym->etype;
- LLVAL (newTree) = 1;
- LRVAL (newTree) = 0;
- TLVAL (newTree) = 1;
- return newTree;
- }
- #endif
- if (!IS_PTR (LTYPE (tree))) {
- tree->type = EX_VALUE;
- tree->opval.val =
- valCastLiteral (LTYPE (tree),
- floatFromVal (valFromType (RTYPE (tree))));
- TTYPE (tree) = tree->opval.val->type;
- tree->left = NULL;
- tree->right = NULL;
- tree->values.literalFromCast = 1;
- TETYPE (tree) = getSpec (TTYPE (tree));
- return tree;
+ if (IS_LITERAL (RETYPE (tree)))
+ {
+ #if 0
+ if (IS_PTR (LTYPE (tree)) && !IS_GENPTR (LTYPE (tree)) )
+ {
+ /* rewrite (type *)litaddr
+ as &temp
+ and define type at litaddr temp
+ (but only if type's storage class is not generic)
+ */
+ ast *newTree = newNode ('&', NULL, NULL);
+ symbol *sym;
+
+ TTYPE (newTree) = LTYPE (tree);
+ TETYPE (newTree) = getSpec(LTYPE (tree));
+
+ /* define a global symbol at the casted address*/
+ sym = newSymbol(genSymName (0), 0);
+ sym->type = LTYPE (tree)->next;
+ if (!sym->type)
+ sym->type = newLink (V_VOID);
+ sym->etype = getSpec(sym->type);
+ SPEC_SCLS (sym->etype) = sclsFromPtr (LTYPE (tree));
+ sym->lineDef = tree->lineno;
+ sym->cdef = 1;
+ sym->isref = 1;
+ SPEC_STAT (sym->etype) = 1;
+ SPEC_ADDR(sym->etype) = floatFromVal (valFromType (RTYPE (tree)));
+ SPEC_ABSA(sym->etype) = 1;
+ addSym (SymbolTab, sym, sym->name, 0, 0, 0);
+ allocGlobal (sym);
+
+ newTree->left = newAst_VALUE(symbolVal(sym));
+ newTree->left->filename = tree->filename;
+ newTree->left->lineno = tree->lineno;
+ LTYPE (newTree) = sym->type;
+ LETYPE (newTree) = sym->etype;
+ LLVAL (newTree) = 1;
+ LRVAL (newTree) = 0;
+ TLVAL (newTree) = 1;
+ return newTree;
+ }
+ #endif
+ if (!IS_PTR (LTYPE (tree)))
+ {
+ tree->type = EX_VALUE;
+ tree->opval.val =
+ valCastLiteral (LTYPE (tree), floatFromVal (valFromType (RTYPE (tree))));
+ TTYPE (tree) = tree->opval.val->type;
+ tree->left = NULL;
+ tree->right = NULL;
+ tree->values.literalFromCast = 1;
+ TETYPE (tree) = getSpec (TTYPE (tree));
+ return tree;
+ }
+ }
+ if (IS_GENPTR (LTYPE (tree)) && IS_PTR (RTYPE (tree)) && !IS_GENPTR (RTYPE (tree)) && (resultType != RESULT_TYPE_GPTR))
+ {
+ DCL_TYPE (LTYPE (tree)) = DCL_TYPE (RTYPE (tree));