foo() {
  for j in 1 2; do
    echo 'break 2' >/tmp/do_break
    echo "  sourcing /tmp/do_break (${j})..."
    # the behavior of the break from running the following command
    # results in unspecified behavior:
    . /tmp/do_break

    do_continue() { continue 2; }
    echo "  running do_continue (${j})..."
    # the behavior of the continue in the following function call
    # results in unspecified behavior (if execution reaches this
    # point):
    do_continue

    trap 'continue 2' USR1
    echo "  sending SIGUSR1 to self (${j})..."
    # the behavior of the continue in the trap invoked from the
    # following signal results in unspecified behavior (if
    # execution reaches this point):
    kill -s USR1 $$
    sleep 1
  done
}
for i in 1 2; do
  echo "running foo (${i})..."
  foo
done
