This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libgomp/38283] FAIL: libgomp.fortran/pr25162.f



------- Comment #1 from danglin at gcc dot gnu dot org  2008-11-27 04:08 -------
emutls_alloc is called with the following struct __emutls_object *:

(gdb) 
emutls_alloc (obj=0x400011d0) at ../../../gcc/libgcc/../gcc/emutls.c:95
95      {
(gdb) p/x $r26
$7 = 0x400011d0
(gdb) p *(struct __emutls_object *) $r26
$8 = {size = 0, align = 0, loc = {offset = 2, ptr = 0x2}, templ = 0x0}

As a result, this code is executed in emutls_alloc:

  /* We could use here posix_memalign if available and adjust
     emutls_destroy accordingly.  */
  if (obj->align <= sizeof (void *))
    {
      ptr = malloc (obj->size + sizeof (void *));
      if (ptr == NULL)
        abort ();
      ((void **) ptr)[0] = ptr;
      ret = ptr + sizeof (void *);
    }

This causes the unaligned pointer.

(gdb) bt
#0  emutls_alloc (obj=0x400011d0) at ../../../gcc/libgcc/../gcc/emutls.c:104
#1  0x7ad79a04 in __emutls_get_address (obj=0x400011d0)
    at ../../../gcc/libgcc/../gcc/emutls.c:180
#2  0x00002ee0 in test1_ ()
    at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:14
#3  0x00002e48 in MAIN__ ()
    at /test/gnu/gcc/gcc/libgomp/testsuite/libgomp.fortran/pr25162.f:5
#4  0x00003278 in main (argc=1, argv=0xf100000)
    at ../../../gcc/libgfortran/fmain.c:21

As far as I can see, the obj passed to __emutls_get_address is never
initialized.  The call assembler is:

        addil LR'__emutls_v.testcom_-$global$,%r27
        copy %r1,%r28
        ldo RR'__emutls_v.testcom_-$global$(%r28),%r26
        .CALL ARGW0=GR
        bl __emutls_get_address,%r2
        nop

__emutls_v.testcom_ is allocated in the $BSS$ subspace:

        .SPACE $PRIVATE$
        .SUBSPA $BSS$

__emutls_v.testcom_     .comm 16

This is a regression, at least a testcase regression, because the tls tests
were previously skipped on this target.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38283


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]