Skip to content

[MG-M3] MLIR generator: has_return misses returns inside if-else #36

Closed

Description

@godofecht

Description

In src/flow/mlir_generator.py (line ~206):

has_return = any(isinstance(stmt, ReturnStatement) for stmt in func.body.statements)

Only checks top-level statements. Returns inside if-else blocks are missed, causing a duplicate func.return to be generated, producing invalid MLIR.

Audit ID: MG-M3

Severity: Medium | Category: Compiler - mlir_generator.py

Activity

  1. added
    bug
    on Feb 7, 2026
  2. godofecht commented on Feb 9, 2026

    @godofecht
    ContributorAuthor

    Fixed in d1811e5. Summary: monomorphize preserves VarDecl mutability; MLIR unary minus uses typed zero const; MLIR return
    detection walks nested blocks; module-scope consts avoid SSA ops; import path traversal blocked + missing imports now error; safer
    paren removal in C generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompilermedium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions