Skip to content

Warn instead of aborting when get_property is given an empty collection - #82

Merged
akashlevy merged 1 commit into
mainfrom
get-property-empty-warn
Sep 3, 2026
Merged

Warn instead of aborting when get_property is given an empty collection#82
akashlevy merged 1 commit into
mainfrom
get-property-empty-warn

Conversation

@akashlevy

Copy link
Copy Markdown

Reapplies #80, which was reverted in #81 because it dropped the diagnostic entirely. Same fix,
except the empty-collection case now warns rather than going silent.

Problem

get_property aborts with Error 2200: get_property object is null. whenever its object
argument is an empty collection. Every get_*/all_* command encodes "nothing matched" as
the empty string, in both list mode and collections mode, so this fires on ordinary code:

set outnets [get_nets -quiet [get_property [all_outputs] name]]

That line is the first line of Preqorsor's power-characterization SDC. On a carved-out block
with no output ports, [all_outputs] is empty and the error killed the interpreter. In one
production run all 16 STA shards died there, losing the timing/power data for ~4100 of 4630
cells about 6.5 hours in.

Fix

Warn and return an empty list. The branch immediately below already maps the property over
every element of a collection, and an empty collection is simply the zero-element case of
that: no objects, no property values. An unmatched lookup is worth telling the user about,
but it should not take the script down with it.

Three details worth reviewing:

  • The warning reuses id 2200, the id this used to error with, so anyone already running
    suppress_msg 2200 keeps the behavior they asked for.
  • -quiet silences it per call. The flag was already parsed and already suppressed the
    sibling "not found" diagnostic on the -object_type path; it is now documented, which it
    previously was not.
  • Non-empty behavior is untouched: one object still yields a bare value, many still yield a
    list.

Test

New test/get_property_empty.tcl links a design whose ports are all inputs and walks the
paths that used to abort: [all_outputs], empty get_ports/get_pins/get_cells/
get_clocks/get_lib_cells, a literal {} and "", the -object_type name-lookup path,
and the get_nets idiom from the SDC above. It pins one warning per call site, covers both
-quiet and suppress_msg 2200, and pins the unchanged non-empty results. Output is
identical with and without sta_enable_collections.

Test plan

  • ./regression -j 12 fast — 110/110 pass
  • ./regression -j 12 -collections fast — the same 4 tests fail before and after this
    change (all_inputs_filters, user_properties, vcd_begin_end_time,
    verilog_port_bundle_find_pin); collections mode is beta and CI does not run it
  • The power SDC prologue that triggered the outage now warns once and runs to completion

Made with Cursor

Reapplies #80, which was reverted in #81 for dropping the diagnostic entirely.

get_property aborted with Error 2200 whenever its object argument was an empty
collection, so a design with no output ports killed the script at
`get_property [all_outputs] name`. That took down whole power-characterization
runs: 16 STA shards died on line 1 of the SDC and lost hours of results.

An empty collection is the zero-element case of the collection branch already
below it, so return an empty list, but keep telling the user about it. The
warning reuses id 2200 so an existing suppress_msg 2200 still applies, and
-quiet silences it per call.

Co-authored-by: Cursor <cursoragent@cursor.com>
@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

The PR changes get_property so an empty object collection emits suppressible warning 2200 and returns an empty list instead of aborting.

  • Documents the existing -quiet option and applies it to the empty-object warning.
  • Adds regression coverage for empty query results, literal empty arguments, warning suppression, collection mode, and unchanged non-empty behavior.
  • Registers a small input-only Verilog fixture and its expected output in the public regression suite.

Confidence Score: 5/5

The PR appears safe to merge; no actionable correctness, compatibility, or security issues were identified.

The empty-object path initializes warning suppression correctly, returns the expected Tcl empty value, retains diagnostic ID compatibility, and is covered across both ordinary and collection modes without changing non-empty behavior.

Important Files Changed

Filename Overview
tcl/Property.tcl Converts the empty-object error into a suppressible warning and empty result while preserving non-empty property behavior.
test/get_property_empty.tcl Exercises empty results across supported object types, suppression mechanisms, the motivating nested-command case, and non-empty results.
test/get_property_empty.ok Pins warning counts and returned values for the new regression coverage.
test/get_property_empty.v Provides an input-only linked design whose output-port collection is empty.
test/regression_vars.tcl Adds the new test to the public regression suite.

Reviews (1): Last reviewed commit: "Warn instead of aborting when get_proper..." | Re-trigger Greptile

@akashlevy
akashlevy merged commit 7f55dfb into main Sep 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant