Skip to content

[Flang] Compilation results in bogus movabsq instruction #161568

@arrowd

Description

@arrowd

I'm compiling the https://github.com/jacobwilliams/json-fortran/releases/tag/9.0.2 project with Flang 21.1.1

The compilation is successful, however running make test results in many tests crashing with SIGSEGV. Here's the backtrace for one of them:

Process 44846 stopped
* thread #1, name = 'jf_test_03', stop reason = signal SIGSEGV: invalid permissions for mapped object (fault address: 0x820d28cb0)
    frame #0: 0x0000000820d28cb0
->  0x820d28cb0: movabsq $0x8226946d0, %r11 ; imm = 0x8226946D0 
    0x820d28cba: movabsq $0x820d28c98, %r10 ; imm = 0x820D28C98 
    0x820d28cc4: jmpq   *%r11
    0x820d28cc7: addb   %dh, 0x820d28e(%rax)
(lldb) bt
* thread #1, name = 'jf_test_03', stop reason = signal SIGSEGV: invalid permissions for mapped object (fault address: 0x820d28cb0)
  * frame #0: 0x0000000820d28cb0
    frame #1: 0x000000082269962d libjsonfortran.so.9.0`_QMjson_value_moduleFjson_traversePtraverse at json_value_module.F90:9590:9
    frame #2: 0x000000082268c6f1 libjsonfortran.so.9.0`_QMjson_value_modulePjson_traverse at json_value_module.F90:9573:38
    frame #3: 0x0000000822654831 libjsonfortran.so.9.0`_QMjson_value_modulePjson_check_all_for_duplicate_keys at json_value_module.F90:5823:9
    frame #4: 0x00000008226740d7 libjsonfortran.so.9.0`_QMjson_value_modulePjson_parse_file at json_value_module.F90:9815:17
    frame #5: 0x000000082269f276 libjsonfortran.so.9.0`_QMjson_file_modulePjson_file_load at json_file_module.F90:871:5
    frame #6: 0x00000000002148e1 jf_test_03`_QMjf_test_3_modPtest_3 at jf_test_03.F90:57:5
    frame #7: 0x0000000000215f11 jf_test_03`_QQmain at jf_test_03.F90:155:5
    frame #8: 0x0000000000215f42 jf_test_03`main at jf_test_03.F90:158:1
    frame #9: 0x0000000824dfec3a libc.so.7`__libc_start1 + 298
    frame #10: 0x00000000002142d0 jf_test_03`_start at crt1_s.S:83

The problem persists even when compiling with -O0 -g.

Metadata

Metadata

Assignees

No one assigned

    Labels

    flangFlang issues not falling into any other category

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions