[flang][OpenMP] don't privatise loop index marked shared (#108176)

Mark the symbol with OmpShared, and then check that later in lowering to
avoid making a local loop index.

OpenMP 5.2 says: "Loop iteration variables of loops that are not associated 
with any OpenMP directive maybe listed in data-sharing attribute clauses on
the surrounding teams, parallel or taskgenerating construct, and on enclosed
constructs, subject to other restrictions."

Tests updated to match the extra OmpShared attribute.

Add regression test for lowering to hlfir.

Closes #102961

---------

Co-authored-by: Tom Eccles <tom.eccles@arm.com>
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 3e9db06..79e5a04 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -1317,7 +1317,8 @@
                                      bool isUnordered) {
     if (isUnordered || sym.has<Fortran::semantics::HostAssocDetails>() ||
         sym.has<Fortran::semantics::UseDetails>()) {
-      if (!shallowLookupSymbol(sym)) {
+      if (!shallowLookupSymbol(sym) &&
+          !sym.test(Fortran::semantics::Symbol::Flag::OmpShared)) {
         // Do concurrent loop variables are not mapped yet since they are local
         // to the Do concurrent scope (same for OpenMP loops).
         mlir::OpBuilder::InsertPoint insPt = builder->saveInsertionPoint();