@@ -597,71 +597,7 @@ def test_cube2hash(self):
597
597
('64bitisslow' , '64D8470573635EC354FEE7B7F87C566FCAF1EFB491041670' )]:
598
598
self .do_run ('src.js' , 'hash value: ' + output , args = [text ], no_build = True )
599
599
600
- def test_unaligned (self ):
601
- self .skipTest ('LLVM marks the reads of s as fully aligned, making this test invalid' )
602
- src = r'''
603
- #include <stdio.h>
604
-
605
- struct S {
606
- double x;
607
- int y;
608
- };
609
-
610
- int main() {
611
- // the 64-bit value here will not be 8-byte aligned
612
- S s0[3] = { {0x12a751f430142, 22}, {0x17a5c85bad144, 98}, {1, 1}};
613
- char buffer[10*sizeof(S)];
614
- int b = int(buffer);
615
- S *s = (S*)(b + 4-b%8);
616
- s[0] = s0[0];
617
- s[1] = s0[1];
618
- s[2] = s0[2];
619
-
620
- printf("*%d : %d : %d\n", sizeof(S), ((unsigned long)&s[0]) % 8 != ((unsigned long)&s[1]) % 8,
621
- ((unsigned long)&s[1]) - ((unsigned long)&s[0]));
622
- s[0].x++;
623
- s[0].y++;
624
- s[1].x++;
625
- s[1].y++;
626
- printf("%.1f,%d,%.1f,%d\n", s[0].x, s[0].y, s[1].x, s[1].y);
627
- return 0;
628
- }
629
- '''
630
-
631
- # TODO: A version of this with int64s as well
632
-
633
- self .do_run (src , '*12 : 1 : 12\n 328157500735811.0,23,416012775903557.0,99\n ' )
634
-
635
- return # TODO: continue to the next part here
636
-
637
- # Test for undefined behavior in C. This is not legitimate code, but does exist
638
-
639
- src = r'''
640
- #include <stdio.h>
641
-
642
- int main()
643
- {
644
- int x[10];
645
- char *p = (char*)&x[0];
646
- p++;
647
- short *q = (short*)p;
648
- *q = 300;
649
- printf("*%d:%ld*\n", *q, ((long)q)%2);
650
- int *r = (int*)p;
651
- *r = 515559;
652
- printf("*%d*\n", *r);
653
- long long *t = (long long*)p;
654
- *t = 42949672960;
655
- printf("*%lld*\n", *t);
656
- return 0;
657
- }
658
- '''
659
-
660
- try :
661
- self .do_run (src , '*300:1*\n *515559*\n *42949672960*\n ' )
662
- except Exception as e :
663
- assert 'must be aligned' in str (e ), e # expected to fail without emulation
664
-
600
+ @only_wasm2js ('tests 64-bit alignment of structs' )
665
601
def test_align64 (self ):
666
602
src = r'''
667
603
#include <stdio.h>
@@ -710,12 +646,7 @@ def test_align64(self):
710
646
0.00,10,123.46,0.00 : 0.00,10,123.46,0.00
711
647
''' )
712
648
713
- @no_asan ('asan errors on corner cases we check' )
714
- @no_lsan ('lsan errors on corner cases we check' )
715
- def test_aligned_alloc (self ):
716
- self .do_runf ('test_aligned_alloc.c' , '' ,
717
- emcc_args = ['-Wno-non-power-of-two-alignment' ])
718
-
649
+ @only_wasm2js ('tests signed vs unsigned values' )
719
650
def test_unsigned (self ):
720
651
src = '''
721
652
#include <stdio.h>
@@ -801,22 +732,26 @@ def test_unsigned(self):
801
732
'''
802
733
self .do_run (src , '*255*\n *65535*\n *-1*\n *-1*\n *-1*' )
803
734
735
+ @only_wasm2js ('tests 1-bit fields' )
804
736
def test_bitfields (self ):
805
737
self .do_core_test ('test_bitfields.c' )
806
738
807
739
def test_floatvars (self ):
808
740
self .do_core_test ('test_floatvars.cpp' )
809
741
742
+ @only_wasm2js ('tests pointer casts' )
810
743
def test_closebitcasts (self ):
811
744
self .do_core_test ('closebitcasts.c' )
812
745
813
746
def test_fast_math (self ):
814
747
self .emcc_args += ['-ffast-math' ]
815
748
self .do_core_test ('test_fast_math.c' , args = ['5' , '6' , '8' ])
816
749
750
+ @only_wasm2js ('tests division by zero' )
817
751
def test_zerodiv (self ):
818
752
self .do_core_test ('test_zerodiv.c' )
819
753
754
+ @only_wasm2js ('tests multiplication by zero' )
820
755
def test_zero_multiplication (self ):
821
756
# needs to flush stdio streams
822
757
self .set_setting ('EXIT_RUNTIME' )
0 commit comments