Skip to content

Commit 1546586

Browse files
committed
32-bit arm alignment crash
1 parent a7f86d6 commit 1546586

4 files changed

Lines changed: 21 additions & 11 deletions

File tree

jsrc/j.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,15 @@ extern unsigned int __cdecl _clearfp (void);
450450
#endif
451451
#endif
452452

453+
#if defined(__clang__) && ( (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5)))
454+
/* needed by clang newer versions, no matter double_trick is inline asm or not */
455+
#define NOOPTIMIZE __attribute__((optnone))
456+
#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 3))
457+
#define NOOPTIMIZE __attribute__((optimize("O0")))
458+
#else
459+
#define NOOPTIMIZE
460+
#endif
461+
453462
#define NALP 256 /* size of alphabet */
454463
#define NETX 2000 /* size of error display buffer */
455464
#define NPP 20 /* max value for quad pp */

jsrc/va1ss.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515

1616
#define SSINGENC(type) ((type)>>INTX)
1717
#define SSINGCASE(id,subtype) (3*(id)+(subtype)) // encode case/args into one branch value
18-
A jtssingleton1(J jt, A w,I caseno){A z;void *zv;
18+
19+
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
20+
#undef NOOPTIMIZE
21+
#define NOOPTIMIZE
22+
#endif
23+
A NOOPTIMIZE jtssingleton1(J jt, A w,I caseno){A z;void *zv;
1924
F2PREFIP;
2025
I ar=AR(w);
2126
// Calculate inplaceability

jsrc/va2ss.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ static NOINLINE I intforD(J jt, D d){D q;I z; // noinline because it uses so ma
3636
}
3737

3838
#define SSINGCASE(id,subtype) (9*(id)+(subtype)) // encode case/args into one branch value
39+
40+
#if !(defined(__aarch32__)||defined(__arm__)||defined(_M_ARM))
41+
#undef NOOPTIMIZE
42+
#define NOOPTIMIZE
43+
#endif
3944
// do singleton operation. ipcaserank bits 0-15=rank of result, 16-23=self->lc code for the operation (with comparisons flagged), 24-25=inplace bits, 26-29 types code
40-
A jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
45+
A NOOPTIMIZE jtssingleton(J jt, A a,A w,I ipcaserank){A z;I aiv;void *zv;
4146
z=0; I ac=AC(a); I wc=AC(w);
4247
// see if we can inplace an assignment. That is always a good idea, though rare
4348
if(unlikely(((B)(a==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEAX)))&(B)1)+((B)(w==jt->asginfo.zombieval)&((B)(ipcaserank>>(24+JTINPLACEWX)))&(B)1))){

jsrc/x15.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,6 @@ static void double_trick(double*v, I n){I i=0;
584584
d[56],d[57],d[58],d[59],d[60],d[61],d[62],d[63]);break; \
585585
}
586586

587-
#if defined(__clang__) && ( (__clang_major__ > 3) || ((__clang_major__ == 3) && (__clang_minor__ > 5)))
588-
/* needed by clang newer versions, no matter double_trick is inline asm or not */
589-
#define NOOPTIMIZE __attribute__((optnone))
590-
#elif __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 3))
591-
#define NOOPTIMIZE __attribute__((optimize("O0")))
592-
#else
593-
#define NOOPTIMIZE
594-
#endif
595-
596587
static I NOOPTIMIZE stdcalli(STDCALLI fp,I*d,I cnt,DoF*dd,I dcnt){I r;
597588
SWITCHCALL;
598589
R r;

0 commit comments

Comments
 (0)