Skip to content

[Code scan] Detect merge_prim_cell extended mismatches independent of argument order #20

Description

@njzjz

This issue comes from a Codex global scan of deepmodeling/tbplas at commit 4d3652b.

Severity: Low

merge_prim_cell() tries to reset extended to 1.0 when component cells have incompatible extended values, but it only checks pc.extended - extended >= 1.e-3. If the first cell has a larger value than a later cell, the difference is negative and the mismatch is missed.

Code reference:

# Determine the 'extended' attribute
extended = pc_list[0].extended
for pc in pc_list:
if (pc.extended - extended) >= 1.e-3:
print(f"INFO: resetting extend to 1.0")
extended = 1.0
break
merged_cell.extended = extended

Suggested fix: compare with abs(pc.extended - extended).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions