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

[BUG] Self-referencing struct makes mojo build crash #3967

Open
gabrieldemarmiesse opened this issue Jan 24, 2025 · 0 comments
Open

[BUG] Self-referencing struct makes mojo build crash #3967

gabrieldemarmiesse opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working mojo-repo Tag all issues with this label

Comments

@gabrieldemarmiesse
Copy link
Contributor

Bug description

My small snippet made the compiler crash. Even if I did a mistake, the compiler should never crash and should give me an helpful error message instead.

Steps to reproduce

from utils import Variant

struct JsonHolder(CollectionElement):
    var value: Variant[List[JsonHolder], Int]
    
    fn __init__(out self, value: None):
        self.value = value

    fn __copyinit__(out self, other: JsonHolder):
        self.value = other.value
    
    fn __moveinit__(out self, owned other: JsonHolder):
        self.value = other.value

def main():
    var a = JsonHolder(None)
magic run mojo build trying_stuff.mojo
[6371:6371:20250124,201157.422165:ERROR elf_dynamic_array_reader.h:64] tag not found
[6371:6371:20250124,201157.423867:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[6371:6371:20250124,201157.423896:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.

System information

magic --version
magic 0.6.2 - (based on pixi 0.40.0)
magic run mojo -v
mojo 25.1.0.dev2025012205 (53d8b341)


     Magic version: 0.6.2
System
------------
       Pixi version: 0.40.0
           Platform: linux-64
   Virtual packages: __unix=0=0
                   : __linux=5.10.102.1=0
                   : __glibc=2.35=0
                   : __cuda=12.5=0
                   : __archspec=1=skylake
          Cache dir: /root/.cache/rattler/cache
       Auth storage: /root/.rattler/credentials.json
   Config locations: No config files found

Global
------------
            Bin dir: /root/.modular/bin
    Environment dir: /root/.modular/envs
       Manifest dir: /root/.modular/manifests/pixi-global.toml

Project
------------
               Name: mojo-simdjson
            Version: 0.1.0
      Manifest file: /projects/open_source/mojo-simdjson/mojoproject.toml
       Last updated: 24-01-2025 19:14:10

Environments
------------
        Environment: default
           Features: default
           Channels: conda-forge, https://conda.modular.com/max-nightly
   Dependency count: 1
       Dependencies: max
   Target platforms: linux-64
@gabrieldemarmiesse gabrieldemarmiesse added bug Something isn't working mojo-repo Tag all issues with this label labels Jan 24, 2025
@gabrieldemarmiesse gabrieldemarmiesse changed the title [BUG] Self-referencing struct crashes the compiler [BUG] Self-referencing struct crashes in mojo build Jan 24, 2025
@gabrieldemarmiesse gabrieldemarmiesse changed the title [BUG] Self-referencing struct crashes in mojo build [BUG] Self-referencing struct makes mojo build crash Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

1 participant