GSoC 2019: POSIX Compliance - FENV Environment probably not working properly in RISCV

Hesham Almatary heshamelmatary at gmail.com
Wed Aug 14 15:26:10 UTC 2019


On Wed, 14 Aug 2019 at 16:18, Vaibhav Gupta <vaibhavgupta40 at gmail.com> wrote:
>
>
>
> On Wed, Aug 14, 2019, 8:09 PM Joel Sherrill <joel at rtems.org> wrote:
>>
>> On Wed, Aug 14, 2019 at 9:35 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com> wrote:
>> >
>> > You are also getting same error :(
>> > I thought problem is with my system/laptop and was trying to correct things.
>> > Should we take the discussion to newlib?
>>
>> I would like Jiri and Hesham to chime in on the next step. I don't
>> know the RISC-V
>> well enough to say if this is a bug in risc-v fenv or not.
>
> Okay

Can you try to build a BSP with FPU instructions? rv32imafdc? and test
again? I assume this will eventually do FPU calculations that will
emit FPU instructions in the case of rv32imafdc or softfloat in the
case of rv32imac.

>>
>>
>> Keep plugging at another architecture.
>
> On that!
>>
>>
>> --joel
>>
>> >
>> > Vaibhav Gupta
>> >
>> > On Wed, Aug 14, 2019 at 7:51 PM Joel Sherrill <joel at rtems.org> wrote:
>> >>
>> >>
>> >> I ran it on sis built from the git repository. Unfortunately, the output doesn't match that I got on Linux.
>> >>
>> >> =============================
>> >> $ ~/sis-riscv/install/bin/sis -riscv -gdb
>> >>
>> >>  SIS - SPARC/RISCV instruction simulator 2.17,  copyright Jiri Gaisler 2019
>> >>  Bug-reports to jiri at gaisler.se
>> >>
>> >>  RISCV emulation enabled, 1 cpus online, delta 50 clocks
>> >>
>> >> gdb: listening on port 1234 connected
>> >> X40000000,0:#72
>> >>
>> >>
>> >> *** BEGIN OF TEST PSXFENV 01 ***
>> >> *** TEST VERSION: 5.0.0.a4d7e4cee77d16b0e34ef543f0804e7eb2954137
>> >> *** TEST STATE: EXPECTED-PASS
>> >> *** TEST BUILD: RTEMS_POSIX_API
>> >> *** TEST TOOLS: 9.1.0 20190503 (RTEMS 5, RSB be90fb89678206e469f2f9189eb290cec49fd827, Newlib 6661a67)
>> >>
>> >> Divide by zero and confirm fetestexcept().
>> >>
>> >> 8
>> >> 0
>> >> 1
>> >>
>> >> *** END OF TEST PSXFENV 01 ***
>> >>
>> >>
>> >> *** FATAL ***
>> >> fatal source: 5 (RTEMS_FATAL_SOURCE_EXIT)
>> >> fatal code: 0 (0x00000000)
>> >> RTEMS version: 5.0.0.a4d7e4cee77d16b0e34ef543f0804e7eb2954137
>> >> RTEMS tools: 9.1.0 20190503 (RTEMS 5, RSB be90fb89678206e469f2f9189eb290cec49fd827, Newlib 6661a67)
>> >> executing thread ID: 0x08a010001
>> >> executing thread name: UI1
>> >> =============================
>> >> On Wed, Aug 14, 2019 at 7:55 AM Vaibhav Gupta <vaibhavgupta40 at gmail.com> wrote:
>> >>>
>> >>>
>> >>>
>> >>> On Wed, Aug 14, 2019 at 6:22 PM Hesham Almatary <heshamelmatary at gmail.com> wrote:
>> >>>>
>> >>>> On Sun, 11 Aug 2019 at 16:49, Vaibhav Gupta <vaibhavgupta40 at gmail.com> wrote:
>> >>>> >
>> >>>> > Configure command I used to build BSP:
>> >>>> > ==============================================
>> >>>> > $ /home/varodek/development/rtems/kernel/rtems/configure --prefix=/home/varodek/development/rtems/5 --enable-maintainer-mode --target=riscv-rtems5 --enable-rtemsbsp=rv32imac --enable-tests --enable-posix --disable-networking --enable-cxx RISCV_ENABLE_HTIF_SUPPORT=1
>> >>>> > ==============================================
>> >>>> > .
>> >>>> RISCV_ENABLE_HTIF_SUPPORT=1 should only be used if you're going to run
>> >>>> on a Spike platform. I see you're using virt below
>> >>>
>> >>> Yah this was the time I was doing all kind of experiments to run the hello  world thing.
>> >>> I have disabled HTIF now.
>> >>>>
>> >>>>
>> >>>> > .
>> >>>> > .
>> >>>> > .
>> >>>> > Qemu command I used to run test:
>> >>>> > ==============================================
>> >>>> > $ qemu-system-riscv32 -no-reboot -nographic -machine virt -m 256M -kernel psxfenv01.exe
>> >>>> > ==============================================
>> >>>> > .
>> >>>> > .
>> >>>> > .
>> >>>> > .
>> >>>> > Makefile.am
>> >>>> > ==============================================
>> >>>> > + if TEST_psxfenv01
>> >>>> > + psx_tests += psxfenv01
>> >>>> > + psxfenv01_SOURCES = psxfenv01/init.c
>> >>>> > + psxfenv01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxfenv01) \
>> >>>> > +       $(support_includes)
>> >>>> > + psxfenv01_LDADD = -lm $(LDADD)
>> >>>> > + endif
>> >>>> > +
>> >>>> > ==============================================
>> >>>> >
>> >>>> > On Sun, Aug 11, 2019 at 8:36 PM Vaibhav Gupta <vaibhavgupta40 at gmail.com> wrote:
>> >>>> >>
>> >>>> >> My code of testsuite:
>> >>>> >> ===============================================
>> >>>> >>   /* Test 'FE_DIVBYZERO' */
>> >>>> >>   puts( "\nDivide by zero and confirm fetestexcept()." );
>> >>>> >>   a = 0.0;
>> >>>> >>   b = 1.0;
>> >>>> >>   c = b/a;
>> >>>> >>   printf("\n%d",FE_DIVBYZERO);
>> >>>> >>   fegetexceptflag(&excepts,FE_ALL_EXCEPT);
>> >>>> >>   printf("\n%d",excepts);
>> >>>> >>   r = feraiseexcept(FE_DIVBYZERO);
>> >>>> >>   printf("\n%d\n",r);
>> >>>> >>   rtems_test_assert( fetestexcept( FE_DIVBYZERO ) );
>> >>>> >> ==============================================
>> >>>> >> OUTPUT
>> >>>> >> ==============================================
>> >>>> >> Divide by zero and confirm fetestexcept().
>> >>>> >>
>> >>>> >> 8
>> >>>> >> 0
>> >>>> >> 1
>> >>>> >> /home/varodek/development/rtems/kernel/rtems/c/src/../../testsuites/psxtests/psxfenv01/init.c: 84 fetestexcept( FE_DIVBYZERO )
>> >>>> >> ==============================================
>> >>>> >> EXPECTED OUTPUT
>> >>>> >> ==============================================
>> >>>> >> Divide by zero and confirm fetestexcept().
>> >>>> >>
>> >>>> >> 8
>> >>>> >> 8
>> >>>> >> 0
>> >>>> >> ==============================================
>> >>>> >> - fetestexcept( FE_DIVBYZERO ), should return a non-zero value as division-by-zero was performed.
>> >>>> >> .
>> >>>> >> - feraiseexcept(FE_DIVBYZERO); is also not working. It should return zero when successful
>> >>>> >> .
>> >>>> >> ==============================================
>> >>>> >>
>> >>>> >> Thank You
>> >>>> >> Vaibhav Gupta
>> >>>> >>
>> >>>> > _______________________________________________
>> >>>> > devel mailing list
>> >>>> > devel at rtems.org
>> >>>> > http://lists.rtems.org/mailman/listinfo/devel
>> >>>>
>> >>>> --
>> >>>> Hesham
>> >>>
>> >>> _______________________________________________
>> >>> devel mailing list
>> >>> devel at rtems.org
>> >>> http://lists.rtems.org/mailman/listinfo/devel



-- 
Hesham



More information about the devel mailing list