public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/61664] New: Microblaze exception handling fails
@ 2014-07-01 14:55 mconner at gnf dot org
  2014-12-04 11:21 ` [Bug target/61664] " nmekala at xilinx dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: mconner at gnf dot org @ 2014-07-01 14:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61664

            Bug ID: 61664
           Summary: Microblaze exception handling fails
           Product: gcc
           Version: 4.6.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mconner at gnf dot org

When an exception is thrown the program aborts as if there were no catch.  The
problem appears to occur regardless of the type of exception thrown or caught.

The following simple example demonstrates the problem:

int
main (void)
{
  try
    {
      throw 42;
    }
  catch (...)
    {
      while (1); // this code is never reached
    }

  return 0; // this code is never reached
}

When this program is executed in the Xilinx SDK (14.6 2013.2 Build EDK_P 25 Mar
2013) debugger, the program aborts.  Call stack after abort is:

 3 _exit() crt0.S:108 0x48000030
 2 kill() kill.c:26 0x480179e0
 1 _kill_r()  0x48010760

This problem is completely reproducible.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/61664] Microblaze exception handling fails
  2014-07-01 14:55 [Bug target/61664] New: Microblaze exception handling fails mconner at gnf dot org
@ 2014-12-04 11:21 ` nmekala at xilinx dot com
  2022-10-29 23:41 ` alpsayin at alpsayin dot com
  2022-10-30  2:23 ` alpsayin at alpsayin dot com
  2 siblings, 0 replies; 4+ messages in thread
From: nmekala at xilinx dot com @ 2014-12-04 11:21 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61664

Nagaraju Mekala <nmekala at xilinx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nmekala at xilinx dot com

--- Comment #1 from Nagaraju Mekala <nmekala at xilinx dot com> ---
Hi Michael,

Exceptions will not work if garbage collector flags are used.
Please let us know if you still face the issue after disabling the garbage
collector flags.

Thanks,
Nagaraju


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/61664] Microblaze exception handling fails
  2014-07-01 14:55 [Bug target/61664] New: Microblaze exception handling fails mconner at gnf dot org
  2014-12-04 11:21 ` [Bug target/61664] " nmekala at xilinx dot com
@ 2022-10-29 23:41 ` alpsayin at alpsayin dot com
  2022-10-30  2:23 ` alpsayin at alpsayin dot com
  2 siblings, 0 replies; 4+ messages in thread
From: alpsayin at alpsayin dot com @ 2022-10-29 23:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61664

Alp Sayin <alpsayin at alpsayin dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alpsayin at alpsayin dot com

--- Comment #2 from Alp Sayin <alpsayin at alpsayin dot com> ---
This issue still persists. I've hit the exact same problem with gcc-12.1.0
built from zephyrproject-rtos/gcc fork.
But more interestingly, I noticed that following code example is able to catch
the exception. 
Whereas any alteration either causes std:terminator to kick in or it causes the
unwinder to hang.

int main()
{
        try
        {
                throw 42;
        }
        // doesnt have to be char type can be any type, but remove this catch
and it exits (std::terminator goes to _exit())
        catch (char c){} 
        catch (int i)
        {
                printf("int catcher\n");
                std::exception_ptr p = std::current_exception();
                printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p);
                printf("Exception Type: %s\n", p ?
p.__cxa_exception_type()->name() : "null");
                return;
        }
        catch (...)
        {
                printf("all catcher\n");
                std::exception_ptr p = std::current_exception();
                printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p);
                printf("Exception Type: %s\n", p ?
p.__cxa_exception_type()->name() : "null");
                return;
        }
        printf("missed all catch");
}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/61664] Microblaze exception handling fails
  2014-07-01 14:55 [Bug target/61664] New: Microblaze exception handling fails mconner at gnf dot org
  2014-12-04 11:21 ` [Bug target/61664] " nmekala at xilinx dot com
  2022-10-29 23:41 ` alpsayin at alpsayin dot com
@ 2022-10-30  2:23 ` alpsayin at alpsayin dot com
  2 siblings, 0 replies; 4+ messages in thread
From: alpsayin at alpsayin dot com @ 2022-10-30  2:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61664

--- Comment #3 from Alp Sayin <alpsayin at alpsayin dot com> ---
(In reply to Alp Sayin from comment #2)
> This issue still persists. I've hit the exact same problem with gcc-12.1.0
> built from zephyrproject-rtos/gcc fork.
> But more interestingly, I noticed that following code example is able to
> catch the exception. 
> Whereas any alteration either causes std:terminator to kick in or it causes
> the unwinder to hang.
> 
> int main()
> {
> 	try
> 	{
> 		throw 42;
> 	}
>         // doesnt have to be char type can be any type, but remove this
> catch and it exits (std::terminator goes to _exit())
> 	catch (char c){} 
> 	catch (int i)
> 	{
> 		printf("int catcher\n");
> 		std::exception_ptr p = std::current_exception();
>     		printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p);
>     		printf("Exception Type: %s\n", p ? p.__cxa_exception_type()->name() :
> "null");
> 		return;
> 	}
> 	catch (...)
> 	{
> 		printf("all catcher\n");
> 		std::exception_ptr p = std::current_exception();
>     		printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p);
>     		printf("Exception Type: %s\n", p ? p.__cxa_exception_type()->name() :
> "null");
> 		return;
> 	}
> 	printf("missed all catch");
> }

Compiler flags as below:


```
microblazeel-zephyr-elf-g++
  -gdwarf-4
  
/home/asayin/zephyr_sdks/microblaze_devel/zephyr-sdk-0.93.0-47-g4470827/microblazeel-zephyr-elf/bin/../lib/gcc/microblazeel-zephyr-elf/12.1.0/bs/m/mh/crtbegin.o
zephyr/CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj
    zephyr/CMakeFiles/zephyr_final.dir/dev_handles.c.obj
zephyr/CMakeFiles/zephyr_final.dir/isr_tables.c.obj
    -o zephyr/zephyr.elf
    zephyr/CMakeFiles/offsets.dir/./arch/microblaze/core/offsets/offsets.c.obj
    -fuse-ld=bfd  -Wl,-T  zephyr/linker.cmd  
   
-Wl,-Map=/scratch/esnap_asayin/twister_out/qemu_microblaze/tests/subsys/cpp/libcxx/cpp.libcxx.newlib/zephyr/zephyr_final.map 
    -Wl,--whole-archive  app/libapp.a  zephyr/libzephyr.a 
zephyr/arch/common/libarch__common.a
    zephyr/arch/arch/microblaze/core/libarch__microblaze__core.a
    zephyr/lib/libc/newlib/liblib__libc__newlib.a
      zephyr/subsys/testsuite/ztest/libsubsys__testsuite__ztest.a
        zephyr/drivers/interrupt_controller/libdrivers__interrupt_controller.a
          zephyr/drivers/console/libdrivers__console.a 
zephyr/drivers/serial/libdrivers__serial.a
            zephyr/drivers/timer/libdrivers__timer.a  
    -Wl,--no-whole-archive  zephyr/kernel/libkernel.a 
   
-L"/home/asayin/zephyr_sdks/microblaze_devel/zephyr-sdk-0.93.0-47-g4470827/microblazeel-zephyr-elf/bin/../lib/gcc/microblazeel-zephyr-elf/12.1.0/bs/m/mh" 
   
-L/scratch/esnap_asayin/twister_out/qemu_microblaze/tests/subsys/cpp/libcxx/cpp.libcxx.newlib/zephyr 
     -lgcc  -Wl,--print-memory-usage  zephyr/arch/common/libisr_tables.a  
    -no-pie  -mlittle-endian  -Wl,--gc-sections  -Wl,--build-id=none 
-Wl,--sort-common=descending
     -Wl,--sort-section=alignment  -Wl,-u,_OffsetAbsSyms  -Wl,-u,_ConfigAbsSyms
 -nostdlib  -static  -Wl,-X  -Wl,-N  -Wl,--orphan-handling=warn  -lstdc++ 
-Wl,--fatal-warnings  -lm  -Wl,-lc  
   
-L"/home/asayin/zephyr_sdks/microblaze_devel/zephyr-sdk-0.93.0-47-g4470827/microblazeel-zephyr-elf/microblazeel-zephyr-elf"/lib/bs/m/mh 
    -Wl,
    -lgcc  
    -lc
/home/asayin/zephyr_sdks/microblaze_devel/zephyr-sdk-0.93.0-47-g4470827/microblazeel-zephyr-elf/bin/../lib/gcc/microblazeel-zephyr-elf/12.1.0/bs/m/mh/crtend.o
```

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-10-30  2:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-01 14:55 [Bug target/61664] New: Microblaze exception handling fails mconner at gnf dot org
2014-12-04 11:21 ` [Bug target/61664] " nmekala at xilinx dot com
2022-10-29 23:41 ` alpsayin at alpsayin dot com
2022-10-30  2:23 ` alpsayin at alpsayin dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).