Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test/run-pass/core-rt-smoke crashes on Windows #7951

Closed
crnobog opened this issue Jul 22, 2013 · 4 comments
Closed

test/run-pass/core-rt-smoke crashes on Windows #7951

crnobog opened this issue Jul 22, 2013 · 4 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows Operating system: Windows

Comments

@crnobog
Copy link

crnobog commented Jul 22, 2013

Starting program: c:\code\rust\i686-pc-mingw32\test\run-pass\core-rt-smoke.stage2-i686-pc-mingw32.exe
[New Thread 8284.0x2488]

Program received signal SIGSEGV, Segmentation fault.

0x680d04d3 in rt::args::load_argc_and_argv::_2199da865b9a2acc::_0$x2e8$x2dpre () from c:\code\rust\install\bin\std-6c65cf4b443341b1-0.8-pre.dll

(gdb) disassemble
Dump of assembler code for function

_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE:
   0x680d0470 <+0>:     cmp    %fs:0x14,%esp
   0x680d0477 <+7>:     ja     0x680d0489 <_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE+25>
   0x680d0479 <+9>:     push   $0xc
   0x680d047e <+14>:    push   $0x24
   0x680d0483 <+19>:    call   0x680d42c8 <__morestack>
   0x680d0488 <+24>:    ret
   0x680d0489 <+25>:    push   %ebp
   0x680d048a <+26>:    mov    %esp,%ebp
   0x680d048c <+28>:    push   %ebx
   0x680d048d <+29>:    push   %edi
   0x680d048e <+30>:    push   %esi
   0x680d048f <+31>:    sub    $0x14,%esp
   0x680d0492 <+34>:    movl   $0x18,0x4(%esp)
   0x680d049a <+42>:    call   0x6803acd0 <_ZN4libc5funcs3c956stdlib6malloc16_54e7a493f6e1cfe14_0$x2e8$x2dpreE>
   0x680d049f <+47>:    mov    %eax,%esi
   0x680d04a1 <+49>:    test   %esi,%esi
   0x680d04a3 <+51>:    jne    0x680d04aa <_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE+58>
   0x680d04a5 <+53>:    call   0x680dc328 <abort>
   0x680d04aa <+58>:    movl   $0x0,(%esi)
   0x680d04b0 <+64>:    movl   $0x10,0x4(%esi)
   0x680d04b7 <+71>:    mov    %esi,-0x10(%ebp)
   0x680d04ba <+74>:    cmpl   $0x0,0xc(%ebp)
   0x680d04be <+78>:    je     0x680d055f <_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE+239>
   0x680d04c4 <+84>:    xor    %ebx,%ebx
   0x680d04c6 <+86>:    lea    -0x10(%ebp),%esi
   0x680d04c9 <+89>:    nop
   0x680d04ca <+90>:    nop
   0x680d04cb <+91>:    nop
   0x680d04cc <+92>:    nop
   0x680d04cd <+93>:    nop
   0x680d04ce <+94>:    nop
   0x680d04cf <+95>:    nop
   0x680d04d0 <+96>:    mov    0x10(%ebp),%eax
=> 0x680d04d3 <+99>:    mov    (%eax,%ebx,4),%eax
   0x680d04d6 <+102>:   cmpb   $0x0,(%eax)
   0x680d04d9 <+105>:   mov    $0x0,%ecx
   0x680d04de <+110>:   je     0x680d04fa <_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE+138>
   0x680d04e0 <+112>:   xor    %ecx,%ecx

The code before the call above:

Dump of assembler code for function _ZN2rt5start15_98ebfd32a7b8f114_0$x2e8$x2dpreE:
=> 0x68082e80 <+0>:     cmp    %fs:0x14,%esp
   0x68082e87 <+7>:     ja     0x68082e99 <_ZN2rt5start15_98ebfd32a7b8f114_0$x2e8$x2dpreE+25>
   0x68082e89 <+9>:     push   $0x14
   0x68082e8e <+14>:    push   $0x2c
   0x68082e93 <+19>:    call   0x680d42c8 <__morestack>
   0x68082e98 <+24>:    ret
   0x68082e99 <+25>:    push   %ebp
   0x68082e9a <+26>:    mov    %esp,%ebp
   0x68082e9c <+28>:    push   %edi
   0x68082e9d <+29>:    push   %esi
   0x68082e9e <+30>:    and    $0xfffffff8,%esp
   0x68082ea4 <+36>:    sub    $0x20,%esp
   0x68082ea7 <+39>:    mov    0x18(%ebp),%edi
   0x68082eaa <+42>:    mov    0x14(%ebp),%esi
   0x68082ead <+45>:    mov    0x10(%ebp),%eax
   0x68082eb0 <+48>:    mov    %eax,0x8(%esp)
   0x68082eb4 <+52>:    mov    0xc(%ebp),%eax
   0x68082eb7 <+55>:    mov    %eax,0x4(%esp)
   0x68082ebb <+59>:    call   0x680d0470 <_ZN2rt4args18load_argc_and_argv17_2199da865b9a2acc14_0$x2e8$x2dpreE>
   0x68082ec0 <+64>:    mov    %eax,0x4(%esp)

(gdb) x/8xw $ebp

0x28fe40:       0x0028fe70      0x68082ec0      0x00480000      0x00400000
0x28fe50:       0x00000000      0x30e6b812      0xfffffffe      0x770e6b96

The instruction mov 0x10(%ebp),%eax looks like it's trying to load argv which is a null. But the value before that doesn't look like a sensible value of argc, so the failure must have happened earlier in the initialisation of the process or the runtime.

@brson
Copy link
Contributor

brson commented Jul 22, 2013

This code should never be called on windows or mac. It's support code for std::os that is only supposed to be used on linux. Both args::init and cleanup should be conditionally-compiled.

@ghost ghost assigned brson Jul 22, 2013
brson added a commit to brson/rust that referenced this issue Jul 22, 2013
@crnobog
Copy link
Author

crnobog commented Jul 23, 2013

test/run-fail/tls-exit-status crashes in the same place when using RUST_NEWRT=1, I assume that'll be fixed by this as well.

@alexcrichton
Copy link
Member

@crnobog, out of curiosity, can you confirm whether this test is now passoing or failing after the std::rt::args module is conditionally compiled out for windows?

@brson brson removed their assignment Feb 10, 2014
@alexcrichton
Copy link
Member

This test no longer exists, closing.

flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 23, 2021
`match_overlapping_arm` refactoring

The main purpose of this pull request is to remove the unneeded and scary `unimplented!()` in the `match_arm_overlapping` code.

The rest is gratuitous refactoring.

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. O-windows Operating system: Windows
Projects
None yet
Development

No branches or pull requests

3 participants