aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorgrischka <grischka>2016-10-16 11:03:57 +0200
committergrischka <grischka>2016-10-16 11:03:57 +0200
commit6245db9fca4046e568da41c6a1f8c51ee9e2f56c (patch)
treeeaeeb028e16d56ee46c2cd46ad5cdbed89df65f4 /tccgen.c
parent4ac0e1971ede1ad3e5bf9f47fad0a8ca0e14525f (diff)
downloadtinycc-6245db9fca4046e568da41c6a1f8c51ee9e2f56c.tar.gz
tinycc-6245db9fca4046e568da41c6a1f8c51ee9e2f56c.tar.bz2
tccgen/32bits: fix unsigned long long -> int cast
gen_cast() failed to truncate long long's if they were unsigned, which was causing mess on the vstack. There was a similar bug here tccgen: 32bits: fix PTR +/- long long ed15cddacd145c74e4600af50f6616ba59ca0d8d Both were not visible until this patch tccgen: arm/i386: save_reg_upstack b691585785086024549cfb9ac65f3397263965aa I'd still assume that this patch is correct per se. Also: - remove 2x !nocode_wanted (we are already under a general "else if (!nocode_wanted)" clause above).
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tccgen.c b/tccgen.c
index 2dcfec5..f7f4d17 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -2315,7 +2315,7 @@ static void gen_cast(CType *type)
}
#if !defined(TCC_TARGET_ARM64) && !defined(TCC_TARGET_X86_64)
} else if ((dbt & VT_BTYPE) == VT_LLONG) {
- if ((sbt & VT_BTYPE) != VT_LLONG && !nocode_wanted) {
+ if ((sbt & VT_BTYPE) != VT_LLONG) {
/* scalar to long long */
/* machine independent conversion */
gv(RC_INT);
@@ -2343,7 +2343,7 @@ static void gen_cast(CType *type)
(dbt & VT_BTYPE) == VT_FUNC) {
if ((sbt & VT_BTYPE) != VT_LLONG &&
(sbt & VT_BTYPE) != VT_PTR &&
- (sbt & VT_BTYPE) != VT_FUNC && !nocode_wanted) {
+ (sbt & VT_BTYPE) != VT_FUNC) {
/* need to convert from 32bit to 64bit */
gv(RC_INT);
if (sbt != (VT_INT | VT_UNSIGNED)) {
@@ -2373,7 +2373,7 @@ static void gen_cast(CType *type)
force_charshort_cast(dbt);
} else if ((dbt & VT_BTYPE) == VT_INT) {
/* scalar to int */
- if (sbt == VT_LLONG && !nocode_wanted) {
+ if ((sbt & VT_BTYPE) == VT_LLONG) {
/* from long long: just take low order word */
lexpand();
vpop();